-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_root.py
More file actions
21 lines (15 loc) · 807 Bytes
/
test_root.py
File metadata and controls
21 lines (15 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastapi import status
from fastapi.testclient import TestClient
from stapi_fastapi.conformance import API
def test_root(stapi_client: TestClient, assert_link) -> None:
res = stapi_client.get("/")
assert res.status_code == status.HTTP_200_OK
assert res.headers["Content-Type"] == "application/json"
body = res.json()
assert body["conformsTo"] == [API.core, API.order_statuses]
assert_link("GET /", body, "self", "/")
assert_link("GET /", body, "service-description", "/openapi.json")
assert_link("GET /", body, "service-docs", "/docs", media_type="text/html")
assert_link("GET /", body, "conformance", "/conformance")
assert_link("GET /", body, "products", "/products")
assert_link("GET /", body, "orders", "/orders", media_type="application/geo+json")