Skip to content

Commit

Permalink
[2.0.x] Removed obsolete and flaky GeoIP tests.
Browse files Browse the repository at this point in the history
Backport of 8f90593 from master.
  • Loading branch information
orf authored and timgraham committed Nov 10, 2018
1 parent 9be172f commit a23d867
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions tests/gis_tests/test_geoip2.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,12 @@ def test04_city(self, gethostbyname):
self.assertEqual('Houston', d['city'])
self.assertEqual('TX', d['region'])
self.assertEqual('America/Chicago', d['time_zone'])

geom = g.geos(query)
self.assertIsInstance(geom, GEOSGeometry)
lon, lat = (-95.4010, 29.7079)
lat_lon = g.lat_lon(query)
lat_lon = (lat_lon[1], lat_lon[0])
for tup in (geom.tuple, g.coords(query), g.lon_lat(query), lat_lon):
self.assertAlmostEqual(lon, tup[0], 4)
self.assertAlmostEqual(lat, tup[1], 4)

@mock.patch('socket.gethostbyname')
def test05_unicode_response(self, gethostbyname):
"GeoIP strings should be properly encoded (#16553)."
gethostbyname.return_value = '194.27.42.76'
g = GeoIP2()
d = g.city('nigde.edu.tr')
self.assertEqual('Niğde', d['city'])
d = g.country('200.26.205.1')
# Some databases have only unaccented countries
self.assertIn(d['country_name'], ('Curaçao', 'Curacao'))
for e1, e2 in (geom.tuple, g.coords(query), g.lon_lat(query), g.lat_lon(query)):
self.assertIsInstance(e1, float)
self.assertIsInstance(e2, float)

def test06_ipv6_query(self):
"GeoIP can lookup IPv6 addresses."
Expand Down

0 comments on commit a23d867

Please sign in to comment.