Docs and tests, responses with headers and cookies (#185)

This commit is contained in:
Sebastián Ramírez
2019-04-26 15:13:59 +04:00
committed by GitHub
parent 8e3a7699a3
commit 528ef7e079
10 changed files with 81 additions and 0 deletions

View File

View File

@@ -0,0 +1,12 @@
from starlette.testclient import TestClient
from response_cookies.tutorial001 import app
client = TestClient(app)
def test_path_operation():
response = client.post("/cookie/")
assert response.status_code == 200
assert response.json() == {"message": "Come to the dark side, we have cookies"}
assert response.cookies["fakesession"] == "fake-cookie-session-value"

View File

View File

@@ -0,0 +1,13 @@
from starlette.testclient import TestClient
from response_headers.tutorial001 import app
client = TestClient(app)
def test_path_operation():
response = client.get("/headers/")
assert response.status_code == 200
assert response.json() == {"message": "Hello World"}
assert response.headers["X-Cat-Dog"] == "alone in the world"
assert response.headers["Content-Language"] == "en-US"