summaryrefslogtreecommitdiff
path: root/tests/messages_tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2020-07-16 08:16:58 +0200
committerGitHub <noreply@github.com>2020-07-16 08:16:58 +0200
commit240cbb63bf9965c63d7a3cc9032f91410f414d46 (patch)
tree14d5fcd1e195f9ceae2c04082a56dfc978f291cb /tests/messages_tests
parent156a2138db20abc89933121e4ff2ee2ce56a173a (diff)
downloaddjango-240cbb63bf9965c63d7a3cc9032f91410f414d46.tar.gz
Fixed #31790 -- Fixed setting SameSite and Secure cookies flags in HttpResponse.delete_cookie().
Cookies with the "SameSite" flag set to None and without the "secure" flag will be soon rejected by latest browser versions. This affects sessions and messages cookies.
Diffstat (limited to 'tests/messages_tests')
-rw-r--r--tests/messages_tests/test_cookie.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/messages_tests/test_cookie.py b/tests/messages_tests/test_cookie.py
index 5675cd15eb..f1428fdf32 100644
--- a/tests/messages_tests/test_cookie.py
+++ b/tests/messages_tests/test_cookie.py
@@ -1,5 +1,6 @@
import json
+from django.conf import settings
from django.contrib.messages import constants
from django.contrib.messages.storage.base import Message
from django.contrib.messages.storage.cookie import (
@@ -85,6 +86,10 @@ class CookieTests(BaseTests, SimpleTestCase):
self.assertEqual(response.cookies['messages'].value, '')
self.assertEqual(response.cookies['messages']['domain'], '.example.com')
self.assertEqual(response.cookies['messages']['expires'], 'Thu, 01 Jan 1970 00:00:00 GMT')
+ self.assertEqual(
+ response.cookies['messages']['samesite'],
+ settings.SESSION_COOKIE_SAMESITE,
+ )
def test_get_bad_cookie(self):
request = self.get_request()