Invalid cookie content should result in an absent cookie, but not in a crash while trying to decode it (#23638).
(self)
| 68 | self.assertEqual(request.COOKIES["want"], "café") |
| 69 | |
| 70 | def test_invalid_unicode_cookie(self): |
| 71 | """ |
| 72 | Invalid cookie content should result in an absent cookie, but not in a |
| 73 | crash while trying to decode it (#23638). |
| 74 | """ |
| 75 | environ = self.request_factory.get("/").environ |
| 76 | environ["HTTP_COOKIE"] = "x=W\x03c(h]\x8e" |
| 77 | request = WSGIRequest(environ) |
| 78 | # We don't test COOKIES content, as the result might differ between |
| 79 | # Python version because parsing invalid content became stricter in |
| 80 | # latest versions. |
| 81 | self.assertIsInstance(request.COOKIES, dict) |
| 82 | |
| 83 | @override_settings(ROOT_URLCONF="handlers.urls") |
| 84 | def test_invalid_multipart_boundary(self): |
nothing calls this directly
no test coverage detected