Exemplo n.º 1
0
def test_to_curl_multiple_cookies():
    r = Request(
        "GET",
        "http://foo.com",
        (),
        (
            acurl.Cookie(False, "foo.com", True, "/", False, 0, "123", "456"),
            acurl.Cookie(False, "foo.com", True, "/", False, 0, "789", "abc"),
        ),
        None,
        None,
        None,
    )
    assert r.to_curl(
    ) == "curl -X GET  --cookie '123=456;789=abc'   http://foo.com"
Exemplo n.º 2
0
def test_to_curl_cookies():
    r = Request(
        "GET",
        "http://foo.com",
        (),
        (acurl.Cookie(False, "foo.com", True, "/", False, 0, "123", "456"), ),
        None,
        None,
        None,
    )
    assert r.to_curl() == "curl -X GET  --cookie 123=456   http://foo.com"
Exemplo n.º 3
0
def test_to_curl_cookies_wrong_domain():
    r = Request(
        "GET",
        "http://foo.com",
        (),
        (
            acurl.Cookie(
                False,
                "bar.com",  # The domain doesn't match, the cookie should not be passed
                True,
                "/",
                False,
                0,
                "123",
                "456",
            ), ),
        None,
        None,
        None,
    )
    assert r.to_curl() == "curl -X GET http://foo.com"
Exemplo n.º 4
0
def test_cookie_zero_expiry():
    # FIXME: what's the right behavior here?ssss
    c = acurl.Cookie(False, "foo.com", False, "/bar", False, 0, "my_cookie",
                     "my_value")
    assert not c.has_expired
Exemplo n.º 5
0
def test_cookie_format():
    c = acurl.Cookie(False, "foo.com", False, "/bar", False, 0, "my_cookie",
                     "my_value")
    assert c.format() == "foo.com\tFALSE\t/bar\tFALSE\t0\tmy_cookie\tmy_value"
Exemplo n.º 6
0
def test_cookie_has_expired():
    c = acurl.Cookie(False, "foo.com", False, "/bar", False, 1, "my_cookie",
                     "my_value")
    assert c.has_expired
Exemplo n.º 7
0
def test_cookie_not_expired():
    c = acurl.Cookie(False, "foo.com", False, "/bar", False,
                     time.time() + 200, "my_cookie", "my_value")
    assert not c.has_expired