Beispiel #1
0
 def test_should_not_update_cookie_if_cookie_is_none(self):
     self.request.COOKIES[
         settings.GEOIP_COOKIE_NAME] = settings.GEOIP_LOCATION_EMPTY_VALUE
     storage = LocationCookieStorage(request=self.request,
                                     response=HttpResponse())
     self.assertFalse(
         storage._should_update_cookie(
             new_value=settings.GEOIP_LOCATION_EMPTY_VALUE))
Beispiel #2
0
 def test_should_update_cookie_if_cookie_is_empty_value(self):
     storage = LocationCookieStorage(request=self.request,
                                     response=HttpResponse())
     self.assertTrue(
         storage._should_update_cookie(
             new_value=settings.GEOIP_LOCATION_EMPTY_VALUE))
Beispiel #3
0
 def test_should_update_cookie_if_cookie_is_obsolete(self):
     self.request.COOKIES[settings.GEOIP_COOKIE_NAME] = 42
     storage = LocationCookieStorage(request=self.request,
                                     response=HttpResponse())
     self.assertTrue(storage._should_update_cookie(new_value=10))
Beispiel #4
0
 def test_should_not_update_cookie_if_no_location_in_request(self):
     storage = LocationCookieStorage(request=HttpRequest(),
                                     response=HttpResponse())
     self.assertFalse(storage._should_update_cookie(new_value=10))
Beispiel #5
0
 def test_should_update_cookie_if_cookie_doesnt_exist(self):
     storage = LocationCookieStorage(request=self.request,
                                     response=HttpResponse())
     self.assertTrue(storage._should_update_cookie(new_value=10))
Beispiel #6
0
 def test_should_update_cookie_if_cookie_is_obsolete(self):
     self.request.COOKIES[settings.GEOIP_COOKIE_NAME] = 42
     storage = LocationCookieStorage(request=self.request, response=HttpResponse())
     self.assertTrue(storage._should_update_cookie(new_value=10))
Beispiel #7
0
 def test_should_not_update_cookie_if_cookie_is_none(self):
     self.request.COOKIES[settings.GEOIP_COOKIE_NAME] = None
     storage = LocationCookieStorage(request=self.request, response=HttpResponse())
     self.assertFalse(storage._should_update_cookie(new_value=None))
Beispiel #8
0
 def test_should_update_cookie_if_cookie_doesnt_exist(self):
     storage = LocationCookieStorage(request=self.request, response=HttpResponse())
     self.assertTrue(storage._should_update_cookie(new_value=10))
Beispiel #9
0
 def test_should_not_update_cookie_if_no_location_in_request(self):
     storage = LocationCookieStorage(request=HttpRequest(), response=HttpResponse())
     self.assertFalse(storage._should_update_cookie(new_value=10))
 def test_should_update_cookie_if_cookie_is_empty_value(self):
     storage = LocationCookieStorage(request=self.request, response=HttpResponse())
     self.assertTrue(storage._should_update_cookie(new_value=settings.GEOIP_LOCATION_EMPTY_VALUE))