ycdemo / fastapi / tests/ test_tutorial/ test_response_cookies/ test_tutorial001.py
from fastapi.testclient import TestClient
from docs_src.response_cookies.tutorial001_py310 import app
client = TestClient(app)
def test_path_operation():
response = client.post("/cookie/")
assert response.status_code == 200, response.text
assert response.json() == {"message": "Come to the dark side, we have cookies"}
assert response.cookies["fakesession"] == "fake-cookie-session-value"