Add sub-app to generate open api spec

This commit is contained in:
Vincent Maillol
2020-10-23 19:44:44 +02:00
parent 1ffde607c9
commit d6b5fc26f3
24 changed files with 932 additions and 124 deletions

View File

@@ -9,7 +9,6 @@ class User(BaseModel):
def test_parse_func_signature():
def body_only(self, user: User):
pass
@@ -37,13 +36,32 @@ def test_parse_func_signature():
def path_body_qs_and_header(self, id: str, /, user: User, page: int, *, auth: UUID):
pass
assert _parse_func_signature(body_only) == ({}, {'user': User}, {}, {})
assert _parse_func_signature(path_only) == ({'id': str}, {}, {}, {})
assert _parse_func_signature(qs_only) == ({}, {}, {'page': int}, {})
assert _parse_func_signature(header_only) == ({}, {}, {}, {'auth': UUID})
assert _parse_func_signature(path_and_qs) == ({'id': str}, {}, {'page': int}, {})
assert _parse_func_signature(path_and_header) == ({'id': str}, {}, {}, {'auth': UUID})
assert _parse_func_signature(qs_and_header) == ({}, {}, {'page': int}, {'auth': UUID})
assert _parse_func_signature(path_qs_and_header) == ({'id': str}, {}, {'page': int}, {'auth': UUID})
assert _parse_func_signature(path_body_qs_and_header) == ({'id': str}, {'user': User}, {'page': int}, {'auth': UUID})
assert _parse_func_signature(body_only) == ({}, {"user": User}, {}, {})
assert _parse_func_signature(path_only) == ({"id": str}, {}, {}, {})
assert _parse_func_signature(qs_only) == ({}, {}, {"page": int}, {})
assert _parse_func_signature(header_only) == ({}, {}, {}, {"auth": UUID})
assert _parse_func_signature(path_and_qs) == ({"id": str}, {}, {"page": int}, {})
assert _parse_func_signature(path_and_header) == (
{"id": str},
{},
{},
{"auth": UUID},
)
assert _parse_func_signature(qs_and_header) == (
{},
{},
{"page": int},
{"auth": UUID},
)
assert _parse_func_signature(path_qs_and_header) == (
{"id": str},
{},
{"page": int},
{"auth": UUID},
)
assert _parse_func_signature(path_body_qs_and_header) == (
{"id": str},
{"user": User},
{"page": int},
{"auth": UUID},
)