fastapi-master/tests/test_tutorial/test_wsgi/test_tutorial001.py

18 lines
436 B
Python
Raw Permalink Normal View History

2024-08-24 12:41:47 +08:00
from fastapi.testclient import TestClient
from docs_src.wsgi.tutorial001 import app
client = TestClient(app)
def test_flask():
response = client.get("/v1/")
assert response.status_code == 200, response.text
assert response.text == "Hello, World from Flask!"
def test_app():
response = client.get("/v2")
assert response.status_code == 200, response.text
assert response.json() == {"message": "Hello World"}