Пример #1
0
    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')
Пример #2
0
    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()
Пример #3
0
    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))
Пример #4
0
    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()
Пример #5
0
    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))
Пример #6
0
 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)
Пример #7
0
    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')
Пример #8
0
 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)