MCPcopy Create free account
hub / github.com/python/cpython / test_samesite_attrs

Method test_samesite_attrs

Lib/test/test_http_cookies.py:239–250  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

237 'Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; Partitioned; Secure')
238
239 def test_samesite_attrs(self):
240 samesite_values = ['Strict', 'Lax', 'strict', 'lax']
241 for val in samesite_values:
242 with self.subTest(val=val):
243 C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
244 C['Customer']['samesite'] = val
245 self.assertEqual(C.output(),
246 'Set-Cookie: Customer="WILE_E_COYOTE"; SameSite=%s' % val)
247
248 C = cookies.SimpleCookie()
249 C.load('Customer="WILL_E_COYOTE"; SameSite=%s' % val)
250 self.assertEqual(C['Customer']['samesite'], val)
251
252 def test_secure_httponly_false_if_not_present(self):
253 C = cookies.SimpleCookie()

Callers

nothing calls this directly

Calls 4

subTestMethod · 0.45
assertEqualMethod · 0.45
outputMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected