M fanboi2/tests/test_utils.py => fanboi2/tests/test_utils.py +7 -2
@@ 92,11 92,16 @@ class TestGeoIP(unittest.TestCase):
return geoip
def _makeGeoIP2(self, country_code=None):
- class MockGeoIP2Response(object):
+ class MockGeoIP2CountryResponse(object):
@property
- def country_code(self):
+ def iso_code(self):
return country_code
+ class MockGeoIP2Response(object):
+ @property
+ def country(self):
+ return MockGeoIP2CountryResponse()
+
class MockGeoIP2(object):
def country(self, ip_address):
return MockGeoIP2Response()
M fanboi2/utils/geoip.py => fanboi2/utils/geoip.py +1 -1
@@ 45,4 45,4 @@ class GeoIP(object):
except AddressNotFoundError:
pass
if response is not None:
- return response.country_code
+ return response.country.iso_code