MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_samesite_attrs

Method test_samesite_attrs

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

Source from the content-addressed store, hash-verified

215 'Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; Partitioned; Secure')
216
217 def test_samesite_attrs(self):
218 samesite_values = ['Strict', 'Lax', 'strict', 'lax']
219 for val in samesite_values:
220 with self.subTest(val=val):
221 C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
222 C['Customer']['samesite'] = val
223 self.assertEqual(C.output(),
224 'Set-Cookie: Customer="WILE_E_COYOTE"; SameSite=%s' % val)
225
226 C = cookies.SimpleCookie()
227 C.load('Customer="WILL_E_COYOTE"; SameSite=%s' % val)
228 self.assertEqual(C['Customer']['samesite'], val)
229
230 def test_secure_httponly_false_if_not_present(self):
231 C = cookies.SimpleCookie()

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected