tests/test_tutorial/test_response_cookies/test_tutorial001.py
raw| 1 | from fastapi.testclient import TestClient |
| 2 | |
| 3 | from docs_src.response_cookies.tutorial001_py310 import app |
| 4 | |
| 5 | client = TestClient(app) |
| 6 | |
| 7 | |
| 8 | def test_path_operation(): |
| 9 | response = client.post("/cookie/") |
| 10 | assert response.status_code == 200, response.text |
| 11 | assert response.json() == {"message": "Come to the dark side, we have cookies"} |
| 12 | assert response.cookies["fakesession"] == "fake-cookie-session-value" |