Resolve some more tests

This commit is contained in:
Adam Hopkins
2021-02-07 11:38:37 +02:00
parent a434ffa8b7
commit c08b153cee
14 changed files with 1052 additions and 749 deletions

View File

@@ -304,24 +304,18 @@ async def test_cookie_customization(app):
_, response = await app.asgi_client.get("/cookie")
CookieDef = namedtuple("CookieDef", ("value", "httponly"))
Cookie = namedtuple("Cookie", ("domain", "path", "value", "httponly"))
cookie_map = {
"test": CookieDef("Cookie1", True),
"c2": CookieDef("Cookie2", False),
}
cookies = {
c.name: Cookie(c.domain, c.path, c.value, "HttpOnly" in c._rest.keys())
for c in response.cookies.jar
}
for name, definition in cookie_map.items():
cookie = cookies.get(name)
cookie = response.cookies.get(name)
assert cookie
assert cookie.value == definition.value
assert cookie.domain == "mockserver.local"
assert cookie.path == "/"
assert cookie.httponly == definition.httponly
assert cookie.get("domain") == "mockserver.local"
assert cookie.get("path") == "/"
assert cookie.get("httponly", False) == definition.httponly
@pytest.mark.asyncio