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

Method test_strict_domain

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

Source from the content-addressed store, hash-verified

923 self.assertEqual(len(c), 0)
924
925 def test_strict_domain(self):
926 # Cookies whose domain is a country-code tld like .co.uk should
927 # not be set if CookiePolicy.strict_domain is true.
928 cp = DefaultCookiePolicy(strict_domain=True)
929 cj = CookieJar(policy=cp)
930 interact_netscape(cj, "http://example.co.uk/", 'no=problemo')
931 interact_netscape(cj, "http://example.co.uk/",
932 'okey=dokey; Domain=.example.co.uk')
933 self.assertEqual(len(cj), 2)
934 for pseudo_tld in [".co.uk", ".org.za", ".tx.us", ".name.us"]:
935 interact_netscape(cj, "http://example.%s/" % pseudo_tld,
936 'spam=eggs; Domain=.co.uk')
937 self.assertEqual(len(cj), 2)
938
939 def test_two_component_domain_ns(self):
940 # Netscape: .www.bar.com, www.bar.com, .bar.com, bar.com, no domain

Callers

nothing calls this directly

Calls 4

DefaultCookiePolicyClass · 0.90
CookieJarClass · 0.90
interact_netscapeFunction · 0.85
assertEqualMethod · 0.45

Tested by

no test coverage detected