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

Method test_secure

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

Source from the content-addressed store, hash-verified

1169 self.assertFalse(req.has_header("Cookie"))
1170
1171 def test_secure(self):
1172 for ns in True, False:
1173 for whitespace in " ", "":
1174 c = CookieJar()
1175 if ns:
1176 pol = DefaultCookiePolicy(rfc2965=False)
1177 int = interact_netscape
1178 vs = ""
1179 else:
1180 pol = DefaultCookiePolicy(rfc2965=True)
1181 int = interact_2965
1182 vs = "; Version=1"
1183 c.set_policy(pol)
1184 url = "http://www.acme.com/"
1185 int(c, url, "foo1=bar%s%s" % (vs, whitespace))
1186 int(c, url, "foo2=bar%s; secure%s" % (vs, whitespace))
1187 self.assertFalse(
1188 c._cookies["www.acme.com"]["/"]["foo1"].secure,
1189 "non-secure cookie registered secure")
1190 self.assertTrue(
1191 c._cookies["www.acme.com"]["/"]["foo2"].secure,
1192 "secure cookie registered non-secure")
1193
1194 def test_secure_block(self):
1195 pol = DefaultCookiePolicy()

Callers

nothing calls this directly

Calls 5

set_policyMethod · 0.95
CookieJarClass · 0.90
DefaultCookiePolicyClass · 0.90
assertFalseMethod · 0.80
assertTrueMethod · 0.80

Tested by

no test coverage detected