Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 """Tests for http/cookiejar.py.""" | 1 """Tests for http/cookiejar.py.""" |
2 | 2 |
3 import re, os, time, urllib.request | 3 import re, os, time, urllib.request |
4 from unittest import TestCase | 4 from unittest import TestCase |
5 | 5 |
6 from test import support | 6 from test import support |
7 | 7 |
8 from http.cookiejar import time2isoz, http2time, time2netscape, \ | 8 from http.cookiejar import time2isoz, http2time, time2netscape, \ |
9 parse_ns_headers, join_header_words, split_header_words, Cookie, \ | 9 parse_ns_headers, join_header_words, split_header_words, Cookie, \ |
10 CookieJar, DefaultCookiePolicy, LWPCookieJar, MozillaCookieJar, \ | 10 CookieJar, DefaultCookiePolicy, LWPCookieJar, MozillaCookieJar, \ |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1440 try: os.unlink(filename) | 1440 try: os.unlink(filename) |
1441 except OSError: pass | 1441 except OSError: pass |
1442 | 1442 |
1443 self.assertEquals(old, repr(c)) | 1443 self.assertEquals(old, repr(c)) |
1444 | 1444 |
1445 def test_url_encoding(self): | 1445 def test_url_encoding(self): |
1446 # Try some URL encodings of the PATHs. | 1446 # Try some URL encodings of the PATHs. |
1447 # (the behaviour here has changed from libwww-perl) | 1447 # (the behaviour here has changed from libwww-perl) |
1448 c = CookieJar(DefaultCookiePolicy(rfc2965=True)) | 1448 c = CookieJar(DefaultCookiePolicy(rfc2965=True)) |
1449 interact_2965(c, "http://www.acme.com/foo%2f%25/" | 1449 interact_2965(c, "http://www.acme.com/foo%2f%25/" |
1450 "%3c%3c%0Anew%C3%A5/%C3%A5", | 1450 "%3c%3c%0Anew%C3%A5/%C3%A5", |
GvR
2008/08/06 21:39:34
I'm guessing this test broke otherwise? Given tha
mgiuca
2008/08/07 12:01:31
As far as I can tell, it's any arbitrary URL allow
| |
1451 "foo = bar; version = 1") | 1451 "foo = bar; version = 1") |
1452 | 1452 |
1453 cookie = interact_2965( | 1453 cookie = interact_2965( |
1454 c, "http://www.acme.com/foo%2f%25/<<%0anew\345/\346\370\345", | 1454 c, "http://www.acme.com/foo%2f%25/<<%0anew\345/\346\370\345", |
1455 'bar=baz; path="/foo/"; version=1'); | 1455 'bar=baz; path="/foo/"; version=1'); |
1456 version_re = re.compile(r'^\$version=\"?1\"?', re.I) | 1456 version_re = re.compile(r'^\$version=\"?1\"?', re.I) |
1457 self.assert_("foo=bar" in cookie and version_re.search(cookie)) | 1457 self.assert_("foo=bar" in cookie and version_re.search(cookie)) |
1458 | 1458 |
1459 cookie = interact_2965( | 1459 cookie = interact_2965( |
1460 c, "http://www.acme.com/foo/%25/<<%0anew\345/\346\370\345") | 1460 c, "http://www.acme.com/foo/%25/<<%0anew\345/\346\370\345") |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1632 support.run_unittest( | 1632 support.run_unittest( |
1633 DateTimeTests, | 1633 DateTimeTests, |
1634 HeaderTests, | 1634 HeaderTests, |
1635 CookieTests, | 1635 CookieTests, |
1636 FileCookieJarTests, | 1636 FileCookieJarTests, |
1637 LWPCookieTests, | 1637 LWPCookieTests, |
1638 ) | 1638 ) |
1639 | 1639 |
1640 if __name__ == "__main__": | 1640 if __name__ == "__main__": |
1641 test_main(verbose=True) | 1641 test_main(verbose=True) |
LEFT | RIGHT |