From e4043a04b8bcc179e8ba5b1181bb6ef076760c86 Mon Sep 17 00:00:00 2001 From: Jaisen Mathai Date: Sat, 29 Oct 2016 23:54:20 -0700 Subject: [PATCH] Add geolocation tests --- elodie/tests/geolocation_test.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/elodie/tests/geolocation_test.py b/elodie/tests/geolocation_test.py index 2a6cb6f..f6f0a6d 100644 --- a/elodie/tests/geolocation_test.py +++ b/elodie/tests/geolocation_test.py @@ -101,6 +101,16 @@ def test_lookup_with_invalid_location(): res = geolocation.lookup(location='foobar dne') assert res is None, res +def test_lookup_with_invalid_location(): + res = geolocation.lookup(location='foobar dne') + assert res is None, res + +def test_lookup_with_valid_key(): + res = geolocation.lookup(location='Sunnyvale, CA') + latLng = res['results'][0]['locations'][0]['latLng'] + assert latLng['lat'] == 37.36883, latLng + assert latLng['lng'] == -122.03635, latLng + @mock.patch('elodie.geolocation.__KEY__', 'invalid_key') def test_lookup_with_invalid_key(): res = geolocation.lookup(location='Sunnyvale, CA')