示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#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))
示例#10
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))