Esempio n. 1
0
def test_request_cookies():
    session_mock = Mock()
    session_mock.get_cookie_list.return_value = ()
    r = create_request(
        "GET",
        "http://foo.com",
        cookies=(
            acurl.parse_cookie_string(
                "foo.com\tFALSE\t/bar\tFALSE\t0\tmy_cookie\tmy_value"),
            acurl.parse_cookie_string(
                "foo.com\tFALSE\t/bar\tFALSE\t0\tfoo\tbar"),
        ),
    )
    assert "my_cookie" in r.cookies
    assert r.cookies["my_cookie"] == "my_value"
    assert "foo" in r.cookies
    assert r.cookies["foo"] == "bar"
Esempio n. 2
0
def test_request_cookies():
    r = acurl.Request(
        "GET",
        "http://foo.com",
        [],
        [
            acurl.parse_cookie_string(
                "foo.com\tFALSE\t/bar\tFALSE\t0\tmy_cookie\tmy_value"),
            acurl.parse_cookie_string(
                "foo.com\tFALSE\t/bar\tFALSE\t0\tfoo\tbar"),
        ],
        None,
        None,
        None,
    )
    assert "my_cookie" in r.cookies
    assert r.cookies["my_cookie"] == "my_value"
    assert "foo" in r.cookies
    assert r.cookies["foo"] == "bar"
Esempio n. 3
0
def test_parse_cookie_string_http_only():
    c = acurl.parse_cookie_string(
        "#HttpOnly_foo.com\tFALSE\t/bar\tFALSE\t0\tmy_cookie\tmy_value")
    assert c.http_only
    assert c.domain == "foo.com"
    assert not c.include_subdomains
    assert c.path == "/bar"
    assert not c.is_secure
    assert c.expiration == 0
    assert c.name == "my_cookie"
    assert c.value == "my_value"