|
|
|
@ -1,6 +1,8 @@ |
|
|
|
import asyncio |
|
|
|
|
|
|
|
from fastapi.testclient import TestClient |
|
|
|
|
|
|
|
from docs_src.path_params.tutorial003b_py39 import app |
|
|
|
from docs_src.path_params.tutorial003b_py39 import app, read_users2 |
|
|
|
|
|
|
|
client = TestClient(app) |
|
|
|
|
|
|
|
@ -11,6 +13,10 @@ def test_get_users(): |
|
|
|
assert response.json() == ["Rick", "Morty"] |
|
|
|
|
|
|
|
|
|
|
|
def test_read_users2(): # Just for coverage |
|
|
|
assert asyncio.run(read_users2()) == ["Bean", "Elfo"] |
|
|
|
|
|
|
|
|
|
|
|
def test_openapi_schema(): |
|
|
|
response = client.get("/openapi.json") |
|
|
|
assert response.status_code == 200, response.text |
|
|
|
|