mirror of
https://github.com/fastapi/fastapi.git
synced 2026-11-25 11:05:53 +08:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
18 lines
441 B
Python
18 lines
441 B
Python
from fastapi.testclient import TestClient
|
|
|
|
from docs_src.wsgi.tutorial001_py39 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"}
|