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

Method test_Cookie_iterator

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

Source from the content-addressed store, hash-verified

1342 "Comment or CommentURL cookie-attributes returned to server")
1343
1344 def test_Cookie_iterator(self):
1345 cs = CookieJar(DefaultCookiePolicy(rfc2965=True))
1346 # add some random cookies
1347 interact_2965(cs, "http://blah.spam.org/", 'foo=eggs; Version=1; '
1348 'Comment="does anybody read these?"; '
1349 'CommentURL="http://foo.bar.net/comment.html"')
1350 interact_netscape(cs, "http://www.acme.com/blah/", "spam=bar; secure")
1351 interact_2965(cs, "http://www.acme.com/blah/",
1352 "foo=bar; secure; Version=1")
1353 interact_2965(cs, "http://www.acme.com/blah/",
1354 "foo=bar; path=/; Version=1")
1355 interact_2965(cs, "http://www.sol.no",
1356 r'bang=wallop; version=1; domain=".sol.no"; '
1357 r'port="90,100, 80,8080"; '
1358 r'max-age=100; Comment = "Just kidding! (\"|\\\\) "')
1359
1360 versions = [1, 0, 1, 1, 1]
1361 names = ["foo", "spam", "foo", "foo", "bang"]
1362 domains = ["blah.spam.org", "www.acme.com", "www.acme.com",
1363 "www.acme.com", ".sol.no"]
1364 paths = ["/", "/blah", "/blah/", "/", "/"]
1365
1366 for i in range(4):
1367 i = 0
1368 for c in cs:
1369 self.assertIsInstance(c, Cookie)
1370 self.assertEqual(c.version, versions[i])
1371 self.assertEqual(c.name, names[i])
1372 self.assertEqual(c.domain, domains[i])
1373 self.assertEqual(c.path, paths[i])
1374 i = i + 1
1375
1376 def test_parse_ns_headers(self):
1377 # missing domain value (invalid cookie)

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected