diff options
author | Tim Graham <timograham@gmail.com> | 2015-07-30 12:16:14 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2015-07-30 18:12:42 -0400 |
commit | 4fc5b487a8c23820240d70f334e612a7fcc33771 (patch) | |
tree | 03d213394babb65c7474c3c213ef2144652a0c6c | |
parent | 0f4f75a3081fe93a20a0c32877a2b61fc6818907 (diff) | |
download | django-4fc5b487a8c23820240d70f334e612a7fcc33771.tar.gz |
[1.7.x] Fixed #25183 -- Fixed non-deterministic GeoIP test.
google.com doesn't always resolve to an IP inside the United States.
Backport of 5b6ca150730cddb09ff8622d49b273d57b9c6703 from master
-rw-r--r-- | django/contrib/gis/geoip/tests.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/django/contrib/gis/geoip/tests.py b/django/contrib/gis/geoip/tests.py index 9631a192ab..589f9f7e93 100644 --- a/django/contrib/gis/geoip/tests.py +++ b/django/contrib/gis/geoip/tests.py @@ -27,6 +27,8 @@ if HAS_GEOS: @skipUnless(HAS_GEOIP and getattr(settings, "GEOIP_PATH", None), "GeoIP is required along with the GEOIP_PATH setting.") class GeoIPTest(unittest.TestCase): + addr = '128.249.1.1' + fqdn = 'tmc.edu' def test01_init(self): "Testing GeoIP initialization." @@ -72,10 +74,7 @@ class GeoIPTest(unittest.TestCase): "Testing GeoIP country querying methods." g = GeoIP(city='<foo>') - fqdn = 'www.google.com' - addr = '12.215.42.19' - - for query in (fqdn, addr): + for query in (self.fqdn, self.addr): for func in (g.country_code, g.country_code_by_addr, g.country_code_by_name): self.assertEqual('US', func(query)) for func in (g.country_name, g.country_name_by_addr, g.country_name_by_name): @@ -88,9 +87,7 @@ class GeoIPTest(unittest.TestCase): "Testing GeoIP city querying methods." g = GeoIP(country='<foo>') - addr = '128.249.1.1' - fqdn = 'tmc.edu' - for query in (fqdn, addr): + for query in (self.fqdn, self.addr): # Country queries should still work. for func in (g.country_code, g.country_code_by_addr, g.country_code_by_name): self.assertEqual('US', func(query)) |