[3.2.x] Fixed GeoIPTest.test04_city() failure with the latest GeoIP2 database.

Backport of 135c800fe6 from master
This commit is contained in:
Mariusz Felisiak 2021-01-29 11:00:12 +01:00
parent 52a4882c40
commit f4d51e12ae
1 changed files with 5 additions and 5 deletions

View File

@ -20,8 +20,8 @@ if HAS_GEOIP2:
"GeoIP is required along with the GEOIP_PATH setting." "GeoIP is required along with the GEOIP_PATH setting."
) )
class GeoIPTest(SimpleTestCase): class GeoIPTest(SimpleTestCase):
addr = '75.41.39.1' addr = '129.237.192.1'
fqdn = 'tmc.edu' fqdn = 'ku.edu'
def test01_init(self): def test01_init(self):
"GeoIP initialization." "GeoIP initialization."
@ -105,7 +105,7 @@ class GeoIPTest(SimpleTestCase):
@mock.patch('socket.gethostbyname') @mock.patch('socket.gethostbyname')
def test04_city(self, gethostbyname): def test04_city(self, gethostbyname):
"GeoIP city querying methods." "GeoIP city querying methods."
gethostbyname.return_value = '75.41.39.1' gethostbyname.return_value = '129.237.192.1'
g = GeoIP2(country='<foo>') g = GeoIP2(country='<foo>')
for query in (self.fqdn, self.addr): for query in (self.fqdn, self.addr):
@ -130,8 +130,8 @@ class GeoIPTest(SimpleTestCase):
self.assertEqual('NA', d['continent_code']) self.assertEqual('NA', d['continent_code'])
self.assertEqual('North America', d['continent_name']) self.assertEqual('North America', d['continent_name'])
self.assertEqual('US', d['country_code']) self.assertEqual('US', d['country_code'])
self.assertEqual('Dallas', d['city']) self.assertEqual('Lawrence', d['city'])
self.assertEqual('TX', d['region']) self.assertEqual('KS', d['region'])
self.assertEqual('America/Chicago', d['time_zone']) self.assertEqual('America/Chicago', d['time_zone'])
self.assertFalse(d['is_in_european_union']) self.assertFalse(d['is_in_european_union'])
geom = g.geos(query) geom = g.geos(query)