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

Method test_missing_value

Lib/test/test_http_cookiejar.py:542–572  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

540 else: self.assertFalse(r)
541
542 def test_missing_value(self):
543 # missing = sign in Cookie: header is regarded by Mozilla as a missing
544 # name, and by http.cookiejar as a missing value
545 filename = os_helper.TESTFN
546 c = MozillaCookieJar(filename)
547 interact_netscape(c, "http://www.acme.com/", 'eggs')
548 interact_netscape(c, "http://www.acme.com/", '"spam"; path=/foo/')
549 cookie = c._cookies["www.acme.com"]["/"]["eggs"]
550 self.assertIsNone(cookie.value)
551 self.assertEqual(cookie.name, "eggs")
552 cookie = c._cookies["www.acme.com"]['/foo/']['"spam"']
553 self.assertIsNone(cookie.value)
554 self.assertEqual(cookie.name, '"spam"')
555 self.assertEqual(lwp_cookie_str(cookie), (
556 r'"spam"; path="/foo/"; domain=www.acme.com; '
557 'path_spec; discard; version=0'))
558 old_str = repr(c)
559 c.save(ignore_expires=True, ignore_discard=True)
560 try:
561 c = MozillaCookieJar(filename)
562 c.revert(ignore_expires=True, ignore_discard=True)
563 finally:
564 os_helper.unlink(c.filename)
565 # cookies unchanged apart from lost info re. whether path was specified
566 self.assertEqual(
567 repr(c),
568 re.sub("path_specified=%s" % True, "path_specified=%s" % False,
569 old_str)
570 )
571 self.assertEqual(interact_netscape(c, "http://www.acme.com/foo/"),
572 '"spam"; eggs')
573
574 @support.subTests('rfc2109_as_netscape,rfc2965,version', [
575 # default according to rfc2965 if not explicitly specified

Callers

nothing calls this directly

Calls 9

saveMethod · 0.95
MozillaCookieJarClass · 0.90
lwp_cookie_strFunction · 0.90
interact_netscapeFunction · 0.85
assertIsNoneMethod · 0.80
revertMethod · 0.80
assertEqualMethod · 0.45
unlinkMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected