MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_rfc2109_handling

Method test_rfc2109_handling

Lib/test/test_http_cookiejar.py:584–603  ·  view source on GitHub ↗
(self, rfc2109_as_netscape, rfc2965, version)

Source from the content-addressed store, hash-verified

582 (True, True, 0),
583 ])
584 def test_rfc2109_handling(self, rfc2109_as_netscape, rfc2965, version):
585 # RFC 2109 cookies are handled as RFC 2965 or Netscape cookies,
586 # dependent on policy settings
587 policy = DefaultCookiePolicy(
588 rfc2109_as_netscape=rfc2109_as_netscape,
589 rfc2965=rfc2965)
590 c = CookieJar(policy)
591 interact_netscape(c, "http://www.example.com/", "ni=ni; Version=1")
592 try:
593 cookie = c._cookies["www.example.com"]["/"]["ni"]
594 except KeyError:
595 self.assertIsNone(version) # didn't expect a stored cookie
596 else:
597 self.assertEqual(cookie.version, version)
598 # 2965 cookies are unaffected
599 interact_2965(c, "http://www.example.com/",
600 "foo=bar; Version=1")
601 if rfc2965:
602 cookie2965 = c._cookies["www.example.com"]["/"]["foo"]
603 self.assertEqual(cookie2965.version, 1)
604
605 def test_ns_parser(self):
606 c = CookieJar()

Callers

nothing calls this directly

Calls 6

DefaultCookiePolicyClass · 0.90
CookieJarClass · 0.90
interact_netscapeFunction · 0.85
interact_2965Function · 0.85
assertIsNoneMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected