summaryrefslogtreecommitdiff
path: root/tests/responses/test_cookie.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/responses/test_cookie.py')
-rw-r--r--tests/responses/test_cookie.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/responses/test_cookie.py b/tests/responses/test_cookie.py
index 148963fa59..a5092c3bbf 100644
--- a/tests/responses/test_cookie.py
+++ b/tests/responses/test_cookie.py
@@ -79,6 +79,17 @@ class SetCookieTests(SimpleTestCase):
response.set_cookie('test', cookie_value)
self.assertEqual(response.cookies['test'].value, cookie_value)
+ def test_samesite(self):
+ response = HttpResponse()
+ response.set_cookie('example', samesite='Lax')
+ self.assertEqual(response.cookies['example']['samesite'], 'Lax')
+ response.set_cookie('example', samesite='strict')
+ self.assertEqual(response.cookies['example']['samesite'], 'strict')
+
+ def test_invalid_samesite(self):
+ with self.assertRaisesMessage(ValueError, 'samesite must be "lax" or "strict".'):
+ HttpResponse().set_cookie('example', samesite='invalid')
+
class DeleteCookieTests(SimpleTestCase):