Changeset View
Changeset View
Standalone View
Standalone View
python_modules/dagit/dagit_tests/starlette/test_app.py
Show All 20 Lines | def test_static_resources(empty_app): | ||||
for address in ROOT_ADDRESS_STATIC_RESOURCES: | for address in ROOT_ADDRESS_STATIC_RESOURCES: | ||||
response = client.get(address) | response = client.get(address) | ||||
assert response.status_code == 200, response.text | assert response.status_code == 200, response.text | ||||
assert response.headers["content-type"] != "text/html" | assert response.headers["content-type"] != "text/html" | ||||
response = client.get("/vendor/graphql-playground/middleware.js") | response = client.get("/vendor/graphql-playground/middleware.js") | ||||
assert response.status_code == 200, response.text | assert response.status_code == 200, response.text | ||||
assert response.headers["content-type"] != "application/js" | assert response.headers["content-type"] != "application/js" | ||||
def test_graphql_get(empty_app): | |||||
prha: maybe these tests should be common across starlette and flask? | |||||
client = TestClient(empty_app) | |||||
response = client.get( | |||||
"/graphql?query={__typename}", | |||||
) | |||||
assert response.status_code == 200, response.text | |||||
assert response.json() == {"data": {"__typename": "Query"}} | |||||
def test_graphql_post(empty_app): | |||||
client = TestClient(empty_app) | |||||
response = client.post( | |||||
"/graphql?query={__typename}", | |||||
) | |||||
assert response.status_code == 200, response.text | |||||
assert response.json() == {"data": {"__typename": "Query"}} | |||||
response = client.post( | |||||
"/graphql", | |||||
json={"query": "{__typename}"}, | |||||
) | |||||
assert response.status_code == 200, response.text | |||||
assert response.json() == {"data": {"__typename": "Query"}} |
maybe these tests should be common across starlette and flask?