Add geolocation tests

This commit is contained in:
Jaisen Mathai 2016-10-29 23:54:20 -07:00
parent 16f4025179
commit e4043a04b8
1 changed files with 10 additions and 0 deletions

View File

@ -101,6 +101,16 @@ def test_lookup_with_invalid_location():
res = geolocation.lookup(location='foobar dne') res = geolocation.lookup(location='foobar dne')
assert res is None, res 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') @mock.patch('elodie.geolocation.__KEY__', 'invalid_key')
def test_lookup_with_invalid_key(): def test_lookup_with_invalid_key():
res = geolocation.lookup(location='Sunnyvale, CA') res = geolocation.lookup(location='Sunnyvale, CA')