diff options
author | Georg Brandl <georg@python.org> | 2006-05-08 17:28:47 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-05-08 17:28:47 (GMT) |
commit | a166a91659795b97144bbd9f1c2adf89c8adc694 (patch) | |
tree | 1ca5bd1fcbcd3cb94d7bd8e4ad000124f833cac9 | |
parent | 9f485bcd682ed9744ad21de2be3cf2dd3b009353 (diff) | |
download | cpython-a166a91659795b97144bbd9f1c2adf89c8adc694.zip cpython-a166a91659795b97144bbd9f1c2adf89c8adc694.tar.gz cpython-a166a91659795b97144bbd9f1c2adf89c8adc694.tar.bz2 |
Add test for rev. 45934.
-rw-r--r-- | Lib/test/test_cookielib.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_cookielib.py b/Lib/test/test_cookielib.py index 49e7d47..991506c 100644 --- a/Lib/test/test_cookielib.py +++ b/Lib/test/test_cookielib.py @@ -695,6 +695,22 @@ class CookieTests(TestCase): 'foo=bar; domain=friendly.org; Version="1"') self.assertEquals(len(c), 0) + def test_strict_domain(self): + # Cookies whose domain is a country-code tld like .co.uk should + # not be set if CookiePolicy.strict_domain is true. + from cookielib import CookieJar, DefaultCookiePolicy + + cp = DefaultCookiePolicy(strict_domain=True) + cj = CookieJar(policy=cp) + interact_netscape(cj, "http://example.co.uk/", 'no=problemo') + interact_netscape(cj, "http://example.co.uk/", + 'okey=dokey; Domain=.example.co.uk') + self.assertEquals(len(cj), 2) + for pseudo_tld in [".co.uk", ".org.za", ".tx.us", ".name.us"]: + interact_netscape(cj, "http://example.%s/" % pseudo_tld, + 'spam=eggs; Domain=.co.uk') + self.assertEquals(len(cj), 2) + def test_two_component_domain_ns(self): # Netscape: .www.bar.com, www.bar.com, .bar.com, bar.com, no domain # should all get accepted, as should .acme.com, acme.com and no domain |