diff options
| author | Flavio Curella <flavio.curella@gmail.com> | 2015-07-30 12:24:08 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-07-31 10:09:06 -0400 |
| commit | 1e2362ca0f2805e91204a7b005e5aed293b40c9e (patch) | |
| tree | 9e772d65e7d63f3d222f900860a81fab46376fdf /tests | |
| parent | 7f0953ce1f1e263a2a74db52d70cdf278840a1d2 (diff) | |
Refs #25184 -- Started deprecation for contrib.gis.geoip.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gis_tests/test_geoip.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/gis_tests/test_geoip.py b/tests/gis_tests/test_geoip.py index c77c7cc529..6afd441216 100644 --- a/tests/gis_tests/test_geoip.py +++ b/tests/gis_tests/test_geoip.py @@ -3,12 +3,15 @@ from __future__ import unicode_literals import os import unittest +import warnings from unittest import skipUnless from django.conf import settings from django.contrib.gis.geoip import HAS_GEOIP from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry +from django.test import ignore_warnings from django.utils import six +from django.utils.deprecation import RemovedInDjango20Warning if HAS_GEOIP: from django.contrib.gis.geoip import GeoIP, GeoIPException @@ -22,6 +25,7 @@ if HAS_GEOIP: @skipUnless(HAS_GEOIP and getattr(settings, "GEOIP_PATH", None), "GeoIP is required along with the GEOIP_PATH setting.") +@ignore_warnings(category=RemovedInDjango20Warning) class GeoIPTest(unittest.TestCase): addr = '128.249.1.1' fqdn = 'tmc.edu' @@ -115,3 +119,12 @@ class GeoIPTest(unittest.TestCase): d = g.country('200.26.205.1') # Some databases have only unaccented countries self.assertIn(d['country_name'], ('CuraƧao', 'Curacao')) + + def test_deprecation_warning(self): + with warnings.catch_warnings(record=True) as warns: + warnings.simplefilter('always') + GeoIP() + + self.assertEqual(len(warns), 1) + msg = str(warns[0].message) + self.assertIn('django.contrib.gis.geoip is deprecated', msg) |
