def setUp(self, *args, **kwargs): self.factory = RequestFactory() create_custom_location(MyCustomLocation, city__name='city1') self.my_location = create_custom_location(MyCustomLocation, id=200, city__name='city200')
def setUp(self): self.url = '/set_location/' self.location = create_custom_location(MyCustomLocation) self.location_model_patcher = patch.object( settings, 'GEOIP_LOCATION_MODEL', 'test_app.models.MyCustomLocation') self.location_model = self.location_model_patcher.start()
def test_validate_location(self): self.assertFalse(self.storage._validate_location(None)) self.assertFalse(self.storage._validate_location(Mock())) location = create_custom_location(MyCustomLocation) self.assertTrue(self.storage._validate_location(location))
def setUp(self): self.url = '/geoip/setlocation/' self.location = create_custom_location(MyCustomLocation) self.location_model_patcher = patch.object(settings, 'GEOIP_LOCATION_MODEL', 'test_app.models.MyCustomLocation') self.location_model = self.location_model_patcher.start()
def test_get_stored_location_ok(self): location = create_custom_location(MyCustomLocation, name='location1') self.locator.request.COOKIES['geoip_location_id'] = location.id self.assertEqual(self.locator._get_stored_location(), location)