elif request.url.path.startswith("/set_cookie"):
headers = {"set-cookie": "example-name=example-value"}
return Response(200, headers=headers, request=request)
+ else:
+ raise NotImplementedError # pragma: no cover
@pytest.mark.asyncio
-async def test_set_cookie():
+async def test_set_cookie() -> None:
"""
Send a request including a cookie.
"""
@pytest.mark.asyncio
-async def test_set_cookie_with_cookiejar():
+async def test_set_cookie_with_cookiejar() -> None:
"""
Send a request including a cookie, using a `CookieJar` instance.
"""
discard=True,
comment=None,
comment_url=None,
- rest={"HttpOnly": None},
+ rest={"HttpOnly": ""},
rfc2109=False,
)
cookies.set_cookie(cookie)
@pytest.mark.asyncio
-async def test_setting_client_cookies_to_cookiejar():
+async def test_setting_client_cookies_to_cookiejar() -> None:
"""
Send a request including a cookie, using a `CookieJar` instance.
"""
discard=True,
comment=None,
comment_url=None,
- rest={"HttpOnly": None},
+ rest={"HttpOnly": ""},
rfc2109=False,
)
cookies.set_cookie(cookie)
client = Client(dispatch=MockDispatch())
- client.cookies = cookies
+ client.cookies = cookies # type: ignore
response = await client.get(url)
assert response.status_code == 200
@pytest.mark.asyncio
-async def test_set_cookie_with_cookies_model():
+async def test_set_cookie_with_cookies_model() -> None:
"""
Send a request including a cookie, using a `Cookies` instance.
"""
@pytest.mark.asyncio
-async def test_get_cookie():
+async def test_get_cookie() -> None:
url = "http://example.org/set_cookie"
client = Client(dispatch=MockDispatch())
@pytest.mark.asyncio
-async def test_cookie_persistence():
+async def test_cookie_persistence() -> None:
"""
Ensure that Client instances persist cookies between requests.
"""