Пример #1
0
 def test_locations_returned(self, geoip_mock, current_app):
     current_app.config = {'GEO': True}
     self.create_mock_ip_addresses(geoip_mock)
     locs = cache.get_locations()
     coords = [(l['loc']['latitude'], l['loc']['longitude']) for l in locs]
     expected = [(1, 1), (2, 2)]
     assert coords == expected
Пример #2
0
 def test_get_locations_ignores_invalid_or_null_ips(self, geoip_mock,
                                                    current_app):
     current_app.config = {'GEO': True}
     self.create_mock_ip_addresses(geoip_mock)
     TaskRunFactory.create(info={'ip_address': 'nonsense'})
     TaskRunFactory.create(info={'ip_address': None})
     TaskRunFactory.create(info={})
     TaskRunFactory.create()
     locs = cache.get_locations()
     coords = [(l['loc']['latitude'], l['loc']['longitude']) for l in locs]
     expected = [(1, 1), (2, 2)]
     assert coords == expected
Пример #3
0
 def test_get_locations_returns_empty_list_when_no_data(self):
     l = cache.get_locations()
     assert l == []