mirror of https://github.com/tiangolo/fastapi.git
Update and rename test_tutorial003.py to test_tutorial003b.py
it was tutorial003b with over fonction names
This commit is contained in:
parent
d5a72366d2
commit
1af0aa1f98
|
|
@ -1,26 +1,25 @@
|
|||
from fastapi.routing import APIRoute
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
import docs_src.path_params.tutorial003 as t3
|
||||
import docs_src.path_params.tutorial003b as t3
|
||||
|
||||
client = TestClient(t3.app)
|
||||
|
||||
|
||||
def test_get_users():
|
||||
response = client.get("/users")
|
||||
print(response.json())
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"user_id": "the current user"}
|
||||
assert response.json() == ['Rick', 'Morty']
|
||||
|
||||
|
||||
def test_routes_created():
|
||||
root1 = APIRoute(
|
||||
path="/users", endpoint=t3.read_user, methods=["GET"], name="name='read_user"
|
||||
path="/users", endpoint=t3.read_users, methods=["GET"], name="read_users"
|
||||
)
|
||||
root2 = APIRoute(
|
||||
path="/users",
|
||||
endpoint=t3.read_user_me,
|
||||
endpoint=t3.read_users2,
|
||||
methods=["GET"],
|
||||
name="name='read_user_me'",
|
||||
name="read_users2",
|
||||
)
|
||||
assert (root1 in t3.app.router.routes) and (root2 in t3.app.router.routes)
|
||||
Loading…
Reference in New Issue