diff --git a/bumblebee_status/util/location.py b/bumblebee_status/util/location.py index 3d9494f..00ac5fd 100644 --- a/bumblebee_status/util/location.py +++ b/bumblebee_status/util/location.py @@ -32,8 +32,8 @@ __sources = [ { "url": "http://ip-api.com/json", "mapping": { - "latitude": "lat", - "longitude": "lon", + "lat": "latitude", + "lon": "longitude", "country": "country_name", "countryCode": "country_code", "city": "city_name", diff --git a/tests/util/test_location.py b/tests/util/test_location.py index e04e600..b86f62e 100644 --- a/tests/util/test_location.py +++ b/tests/util/test_location.py @@ -14,16 +14,16 @@ def urllib_req(mocker): def secondaryLocation(): return { "country": "Middle Earth", - "longitude": "10.0", - "latitude": "20.5", - "ip": "127.0.0.1", + "lon": "10.0", + "lat": "20.5", + "query": "127.0.0.1", } @pytest.fixture def primaryLocation(): return { - "country_name": "Rivia", + "country": "Rivia", "longitude": "-10.0", "latitude": "-23", "ip": "127.0.0.6", @@ -33,7 +33,7 @@ def primaryLocation(): def test_primary_provider(urllib_req, primaryLocation): urllib_req.urlopen.return_value.read.return_value = json.dumps(primaryLocation) - assert util.location.country() == primaryLocation["country_name"] + assert util.location.country() == primaryLocation["country"] assert util.location.coordinates() == ( primaryLocation["latitude"], primaryLocation["longitude"], @@ -48,10 +48,10 @@ def test_secondary_provider(mocker, urllib_req, secondaryLocation): assert util.location.country() == secondaryLocation["country"] assert util.location.coordinates() == ( - secondaryLocation["latitude"], - secondaryLocation["longitude"], + secondaryLocation["lat"], + secondaryLocation["lon"], ) - assert util.location.public_ip() == secondaryLocation["ip"] + assert util.location.public_ip() == secondaryLocation["query"] # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4