(self)
| 259 | 'Set-Cookie: eggs=scrambled; Path=bar; Secure\r\nSet-Cookie: foo=foo') |
| 260 | |
| 261 | def test_quoted_meta(self): |
| 262 | # Try cookie with quoted meta-data |
| 263 | C = cookies.SimpleCookie() |
| 264 | C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"') |
| 265 | self.assertEqual(C['Customer'].value, 'WILE_E_COYOTE') |
| 266 | self.assertEqual(C['Customer']['version'], '1') |
| 267 | self.assertEqual(C['Customer']['path'], '/acme') |
| 268 | |
| 269 | self.assertEqual(C.output(['path']), |
| 270 | 'Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme') |
| 271 | self.assertEqual(C.js_output(), r""" |
| 272 | <script type="text/javascript"> |
| 273 | <!-- begin hiding |
| 274 | document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme; Version=1"; |
| 275 | // end hiding --> |
| 276 | </script> |
| 277 | """) |
| 278 | self.assertEqual(C.js_output(['path']), r""" |
| 279 | <script type="text/javascript"> |
| 280 | <!-- begin hiding |
| 281 | document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme"; |
| 282 | // end hiding --> |
| 283 | </script> |
| 284 | """) |
| 285 | |
| 286 | def test_invalid_cookies(self): |
| 287 | # Accepting these could be a security issue |
nothing calls this directly
no test coverage detected