From b33bfc383935cd26e19a2cf71d066ac6edd1425f Mon Sep 17 00:00:00 2001 From: Osaetin Daniel Date: Wed, 9 Oct 2019 07:42:55 -0400 Subject: Fixed #30862 -- Allowed setting SameSite cookies flags to 'none'. Thanks Florian Apolloner and Carlton Gibson for reviews. --- tests/responses/test_cookie.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/responses/test_cookie.py b/tests/responses/test_cookie.py index ed881435e4..36cb43ed81 100644 --- a/tests/responses/test_cookie.py +++ b/tests/responses/test_cookie.py @@ -81,13 +81,16 @@ class SetCookieTests(SimpleTestCase): def test_samesite(self): response = HttpResponse() + response.set_cookie('example', samesite='None') + self.assertEqual(response.cookies['example']['samesite'], 'None') 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".'): + msg = 'samesite must be "lax", "none", or "strict".' + with self.assertRaisesMessage(ValueError, msg): HttpResponse().set_cookie('example', samesite='invalid') -- cgit v1.3