MCPcopy Index your code
hub / github.com/python/cpython / test_quoted_meta

Method test_quoted_meta

Lib/test/test_http_cookies.py:283–306  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

281 'Set-Cookie: eggs=scrambled; Path=bar; Secure\r\nSet-Cookie: foo=foo')
282
283 def test_quoted_meta(self):
284 # Try cookie with quoted meta-data
285 C = cookies.SimpleCookie()
286 C.load('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"')
287 self.assertEqual(C['Customer'].value, 'WILE_E_COYOTE')
288 self.assertEqual(C['Customer']['version'], '1')
289 self.assertEqual(C['Customer']['path'], '/acme')
290
291 self.assertEqual(C.output(['path']),
292 'Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acme')
293 self.assertEqual(C.js_output(), r"""
294 <script type="text/javascript">
295 <!-- begin hiding
296 document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme; Version=1";
297 // end hiding -->
298 </script>
299 """)
300 self.assertEqual(C.js_output(['path']), r"""
301 <script type="text/javascript">
302 <!-- begin hiding
303 document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme";
304 // end hiding -->
305 </script>
306 """)
307
308 def test_invalid_cookies(self):
309 # Accepting these could be a security issue

Callers

nothing calls this directly

Calls 4

loadMethod · 0.45
assertEqualMethod · 0.45
outputMethod · 0.45
js_outputMethod · 0.45

Tested by

no test coverage detected