diff options
Diffstat (limited to 'tests/responses/test_cookie.py')
| -rw-r--r-- | tests/responses/test_cookie.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/responses/test_cookie.py b/tests/responses/test_cookie.py index cbd65926c0..148963fa59 100644 --- a/tests/responses/test_cookie.py +++ b/tests/responses/test_cookie.py @@ -91,3 +91,16 @@ class DeleteCookieTests(SimpleTestCase): self.assertEqual(cookie['path'], '/') self.assertEqual(cookie['secure'], '') self.assertEqual(cookie['domain'], '') + + def test_delete_cookie_secure_prefix(self): + """ + delete_cookie() sets the secure flag if the cookie name starts with + __Host- or __Secure- (without that, browsers ignore cookies with those + prefixes). + """ + response = HttpResponse() + for prefix in ('Secure', 'Host'): + with self.subTest(prefix=prefix): + cookie_name = '__%s-c' % prefix + response.delete_cookie(cookie_name) + self.assertEqual(response.cookies[cookie_name]['secure'], True) |
