This commit is contained in:
parent
56f0b1e170
commit
31db4e661a
|
@ -144,7 +144,7 @@ def place_name(lat, lon):
|
||||||
lookup_place_name['default'] = address[loc]
|
lookup_place_name['default'] = address[loc]
|
||||||
|
|
||||||
if('default' not in lookup_place_name):
|
if('default' not in lookup_place_name):
|
||||||
lookup_place_name = 'Unknown Location'
|
lookup_place_name = {'default': 'Unknown Location'}
|
||||||
|
|
||||||
if(lookup_place_name is not {}):
|
if(lookup_place_name is not {}):
|
||||||
db.add_location(lat, lon, lookup_place_name)
|
db.add_location(lat, lon, lookup_place_name)
|
||||||
|
|
|
@ -139,6 +139,14 @@ def test_place_name_cached():
|
||||||
|
|
||||||
assert place_name['city'] == 'UNITTEST', place_name
|
assert place_name['city'] == 'UNITTEST', place_name
|
||||||
|
|
||||||
|
def test_place_name_no_default():
|
||||||
|
# See gh-160 for backwards compatability needed when a string is stored instead of a dict
|
||||||
|
helper.reset_dbs()
|
||||||
|
place_name = geolocation.place_name(123456.000, 123456.000)
|
||||||
|
helper.restore_dbs()
|
||||||
|
|
||||||
|
assert place_name['default'] == 'Unknown Location', place_name
|
||||||
|
|
||||||
@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')
|
||||||
|
|
Loading…
Reference in New Issue