Home | History | Annotate | Download | only in test

Lines Matching defs:Cookie

132         # of Set-Cookie: header
135 # Cookie with name 'expires'
235 return _interact(cookiejar, url, set_cookie_hdrs, "Set-Cookie")
238 """Perform a single request / response cycle, returning Cookie: header."""
242 cookie_hdr = req.get_header("Cookie", "")
304 # Set-Cookie with negative max age.
306 # Set-Cookie cookies.
310 # Should accept unquoted cookie-attribute values? check errata draft.
312 # Should always return quoted cookie-attribute values?
329 ## commas and equals are commonly appear in the cookie value). This also
330 ## means that if you fold multiple Set-Cookie header fields into one,
336 ## parse it, just ignore it and pretend it's a session cookie.
375 # missing = sign in Cookie: header is regarded by Mozilla as a missing
381 cookie = c._cookies["www.acme.com"]["/"]["eggs"]
382 self.assertTrue(cookie.value is None)
383 self.assertEqual(cookie.name, "eggs")
384 cookie = c._cookies["www.acme.com"]['/foo/']['"spam"']
385 self.assertTrue(cookie.value is None)
386 self.assertEqual(cookie.name, '"spam"')
387 self.assertEqual(lwp_cookie_str(cookie), (
416 (False, False, None), # version None here means no cookie stored
427 cookie = c._cookies["www.example.com"]["/"]["ni"]
429 self.assertTrue(version is None) # didn't expect a stored cookie
431 self.assertEqual(cookie.version, version)
451 cookie = c._cookies[".acme.com"]["/"]["spam"]
452 self.assertEqual(cookie.domain, ".acme.com")
453 self.assertTrue(cookie.domain_specified)
454 self.assertEqual(cookie.port, DEFAULT_HTTP_PORT)
455 self.assertTrue(not cookie.port_specified)
457 self.assertTrue(cookie.has_nonstandard_attr("blArgh") and
458 not cookie.has_nonstandard_attr("blargh"))
460 cookie = c._cookies["www.acme.com"]["/"]["ni"]
461 self.assertEqual(cookie.domain, "www.acme.com")
462 self.assertTrue(not cookie.domain_specified)
463 self.assertEqual(cookie.port, "80,8080")
464 self.assertTrue(cookie.port_specified)
466 cookie = c._cookies["www.acme.com"]["/"]["nini"]
467 self.assertTrue(cookie.port is None)
468 self.assertTrue(not cookie.port_specified)
470 # invalid expires should not cause cookie to be dropped
478 # of Set-Cookie: header
492 # if expires is in future, keep cookie...
507 # delete both new cookie and any old matching cookie
578 # cookie is sent back to the same URI
845 headers = ["Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/"]
860 # set a cookie with non-allowed domain...
868 self.assertTrue(not req.has_header("Cookie"))
877 headers = ["Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/"]
895 self.assertTrue((req.has_header("Cookie") and
903 # set a cookie with blocked domain...
911 self.assertTrue(not req.has_header("Cookie"))
933 "non-secure cookie registered secure")
936 "secure cookie registered non-secure")
955 self.assertTrue(req.has_header("Cookie"))
1043 "Comment or CommentURL cookie-attributes returned to server")
1046 from cookielib import CookieJar, Cookie, DefaultCookiePolicy
1072 self.assertIsInstance(c, Cookie)
1082 # missing domain value (invalid cookie)
1093 # missing cookie value (valid cookie)
1114 ["Set-Cookie: "], # actually, nothing wrong with this
1119 ["Set-Cookie: b=foo; max-age=oops"],
1121 ["Set-Cookie: b=foo; version=spam"],
1127 # cookie with invalid expires is treated as session cookie
1128 headers = ["Set-Cookie: c=foo; expires=Foo Bar 12 33:22:11 2000"]
1130 cookie = c._cookies["www.example.com"]["/"]["c"]
1131 self.assertTrue(cookie.expires is None)
1147 # Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT
1151 # Cookie: CUSTOMER=WILE_E_COYOTE
1155 # Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/
1159 # Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001
1163 # Set-Cookie: SHIPPING=FEDEX; path=/fo
1167 # Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001
1171 # Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001; SHIPPING=FEDEX
1173 # The last Cookie is buggy, because both specifications say that the
1174 # most specific cookie must be sent first. SHIPPING=FEDEX is the
1189 "Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/ ; "
1197 self.assertEqual(req.get_header("Cookie"), "CUSTOMER=WILE_E_COYOTE")
1200 headers.append("Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/")
1207 h = req.get_header("Cookie")
1211 headers.append('Set-Cookie: SHIPPING=FEDEX; path=/foo')
1218 h = req.get_header("Cookie")
1226 h = req.get_header("Cookie")
1241 # Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/
1245 # Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001
1249 # Set-Cookie: PART_NUMBER=RIDING_ROCKET_0023; path=/ammo
1253 # Cookie: PART_NUMBER=RIDING_ROCKET_0023; PART_NUMBER=ROCKET_LAUNCHER_0001
1262 headers.append("Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/")
1270 self.assertEqual(req.get_header("Cookie"),
1274 "Set-Cookie: PART_NUMBER=RIDING_ROCKET_0023; path=/ammo")
1283 req.get_header("Cookie")))
1312 # Cookie reflects user's identity.
1314 cookie = interact_2965(
1317 self.assertTrue(not cookie)
1323 # Cookie: $Version="1"; Customer="WILE_E_COYOTE"; $Path="/acme"
1336 cookie = interact_2965(c, 'http://www.acme.com/acme/pickitem',
1341 cookie))
1347 # Cookie: $Version="1";
1359 # New cookie reflects shipping method.
1361 cookie = interact_2965(c, "http://www.acme.com/acme/shipping",
1364 self.assertTrue(re.search(r'^\$Version="?1"?;', cookie))
1366 '\s*\$Path="\/acme"', cookie))
1368 cookie))
1374 # Cookie: $Version="1";
1388 cookie = interact_2965(c, "http://www.acme.com/acme/process")
1390 re.search(r'Shipping="?FedEx"?;\s*\$Path="\/acme"', cookie) and
1391 "WILE_E_COYOTE" in cookie)
1395 # each of which it receives a new cookie. All the cookies have the same
1430 # Cookie: $Version="1";
1434 # Note that the NAME=VALUE pair for the cookie with the more specific Path
1436 # attribute, /acme. Further note that the same cookie name appears more
1439 cookie = interact_2965(c, "http://www.acme.com/acme/ammo/...")
1441 re.search(r"Riding_Rocket_0023.*Rocket_Launcher_0001", cookie))
1446 # Cookie: $Version="1"; Part_Number="Rocket_Launcher_0001"; $Path="/acme"
1448 # Here, the second cookie's Path attribute /acme/ammo is not a prefix of
1449 # the request URL, /acme/parts/, so the cookie does not get forwarded to
1452 cookie = interact_2965(c, "http://www.acme.com/acme/parts/")
1453 self.assertIn("Rocket_Launcher_0001", cookie)
1454 self.assertNotIn("Riding_Rocket_0023", cookie)
1467 cookie = interact_2965(c, "http://www.acme.com",
1472 cookie = interact_2965(c, "http://www.acme.com",
1477 cookie = interact_2965(c, "http://www.a.acme.com",
1482 cookie = interact_2965(c, "http://www.a.acme.com",
1487 cookie = interact_2965(c, "http://125.125.125.125",
1492 cookie = interact_2965(c, "http://www.sol.no",
1498 cookie = interact_2965(c, "http://www.sol.no/foo/bar",
1504 cookie = interact_2965(c, "http://www.sol.no",
1510 cookie = interact_2965(
1518 cookie = interact_2965(c, "http://www.sol.no",
1526 ## cookie = interact_2965(c, "http://www.sol.no/foo/",
1530 cookie = interact_2965(c, "http://www.sol.no/<oo/",
1558 cookie = interact_2965(
1562 self.assertTrue("foo=bar" in cookie and version_re.search(cookie))
1564 cookie = interact_2965(
1566 self.assertTrue(not cookie)
1569 cookie = interact_2965(c, u"http://www.acme.com/\xfc")
1572 # Save / load Mozilla/Netscape cookie file format.
1624 headers.append("Set-Cookie: Customer=WILE_E_COYOTE; domain=.acme.com")
1630 # in the cookie value.
1631 headers.append("Set-Cookie: PART_NUMBER=3,4; domain=foo.bar.acme.com")
1638 "PART_NUMBER=3,4" in req.get_header("Cookie") and
1639 "Customer=WILE_E_COYOTE" in req.get_header("Cookie"))
1648 cookie = interact_2965(c, "http://example/",
1650 self.assertIn("foo1=bar", cookie)
1653 cookie = interact_2965(c, "http://example/")
1654 self.assertIn("foo2=bar", cookie)
1662 cookie = interact_netscape(c, "http://example/",
1665 self.assertIn("foo1=bar", cookie)
1667 cookie = interact_netscape(c, "http://example/")
1668 self.assertIn("foo2=bar", cookie)
1678 # Set-Cookie: JSESSIONID=ABCDERANDOM123; Path=
1681 # In this case, extract_cookies() must set cookie to / (root)
1686 headers.append("Set-Cookie: JSESSIONID=ABCDERANDOM123; Path=")
1693 self.assertEqual(req.get_header("Cookie"),
1701 self.assertEqual(req.get_header("Cookie"),
1716 headers.append("Set-Cookie: s1=session;Path=/scripts")
1717 headers.append("Set-Cookie: p1=perm; Domain=.perlmeister.com;"
1720 headers.append("Set-Cookie: p2=perm;Path=/;expires=Fri, "
1722 headers.append("Set-Cookie: s2=session;Path=/scripts;"
1734 for cookie in c:
1735 key = "%s_before" % cookie.value
1739 for cookie in c:
1740 key = "%s_after" % cookie.value
1744 # a permanent cookie got lost accidentally
1746 # a session cookie hasn't been cleared