(self, rfc2109_as_netscape, rfc2965, version)
| 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() |
nothing calls this directly
no test coverage detected