Ticket #25407: 25407.diff

File 25407.diff, 978 bytes (added by Tim Graham, 9 years ago)
  • tests/gis_tests/test_geoip2.py

    diff --git a/tests/gis_tests/test_geoip2.py b/tests/gis_tests/test_geoip2.py
    index 290fb35..2026fb9 100644
    a b from unittest import skipUnless  
    88from django.conf import settings
    99from django.contrib.gis.geoip2 import HAS_GEOIP2
    1010from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry
     11from django.test import mock
    1112from django.utils import six
    1213
    1314if HAS_GEOIP2:
    class GeoIPTest(unittest.TestCase):  
    121122                self.assertAlmostEqual(lon, tup[0], 4)
    122123                self.assertAlmostEqual(lat, tup[1], 4)
    123124
    124     def test05_unicode_response(self):
     125    @mock.patch('socket.gethostbyname')
     126    def test05_unicode_response(self, gethostbyname):
    125127        "GeoIP strings should be properly encoded (#16553)."
     128        gethostbyname.return_value = '194.27.42.76'
    126129        g = GeoIP2()
    127130        d = g.city("nigde.edu.tr")
    128131        self.assertEqual('Niğde', d['city'])
Back to Top