1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
from datetime import datetime, timezone
from respx.utils import SetCookie
class TestSetCookie:
def test_can_render_all_attributes(self) -> None:
expires = datetime.fromtimestamp(0, tz=timezone.utc)
cookie = SetCookie(
"foo",
value="bar",
path="/",
domain=".example.com",
expires=expires,
max_age=44,
http_only=True,
same_site="None",
partitioned=True,
)
assert cookie == (
"Set-Cookie",
(
"foo=bar; "
"Path=/; "
"Domain=.example.com; "
"Expires=Thu, 01 Jan 1970 00:00:00 GMT; "
"Max-Age=44; "
"HttpOnly; "
"SameSite=None; "
"Secure; "
"Partitioned"
),
)
|