ycdemo / fastapi / tests/ test_tutorial/ test_response_cookies/ test_tutorial002.py
from fastapi.testclient import TestClient
from docs_src.response_cookies.tutorial002_py310 import app
client = TestClient(app)
def test_path_operation():
response = client.post("/cookie-and-object/")
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"