summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webdriver/tests/bidi/storage/set_cookie/cookie_http_only.py
blob: 4473fbf576cea60810708dd21400ef7730ffecec (plain)
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
import pytest
from .. import assert_cookie_is_set, create_cookie

pytestmark = pytest.mark.asyncio


@pytest.mark.parametrize(
    "http_only",
    [
        True,
        False,
        None
    ])
async def test_cookie_http_only(bidi_session, set_cookie, test_page, domain_value, http_only):
    set_cookie_result = await set_cookie(
        cookie=create_cookie(domain=domain_value(), http_only=http_only))

    assert set_cookie_result == {
        'partitionKey': {},
    }

    # `httpOnly` defaults to `false`.
    expected_http_only = http_only if http_only is not None else False

    await assert_cookie_is_set(
        bidi_session,
        domain=domain_value(),
        http_only=expected_http_only,
    )