Example #1
0
def test_parse_cookie(
    name,
    value,
    expires,
    domain,
    path,
    http_only,
    secure,
    max_age,
    same_site,
    expected_result,
):
    cookie = parse_cookie(expected_result)
    assert cookie is not None
    assert cookie.name == name
    assert cookie.value == value
    if expires:
        assert cookie.expires is not None
        assert datetime_from_cookie_format(cookie.expires) == expires
    assert cookie.domain == domain
    assert cookie.path == path
    assert cookie.http_only == http_only
    assert cookie.secure == secure
    if max_age:
        assert cookie.max_age is not None
        assert datetime_from_cookie_format(cookie.max_age) == max_age
Example #2
0
def test_datetime_from_cookie_format(value, expected_result):
    parsed = datetime_from_cookie_format(value)
    assert parsed == expected_result