fix: update tests
This commit is contained in:
parent
9d488db276
commit
76dd0106be
@ -3,4 +3,7 @@ requires = [
|
|||||||
"setuptools >= 46.4.0",
|
"setuptools >= 46.4.0",
|
||||||
"wheel",
|
"wheel",
|
||||||
]
|
]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
asyncio_mode = "auto"
|
@ -44,6 +44,7 @@ async def test_post_an_article_with_wrong_type_field_should_return_an_error_mess
|
|||||||
|
|
||||||
client = await aiohttp_client(app)
|
client = await aiohttp_client(app)
|
||||||
resp = await client.post("/article", json={"name": "foo", "nb_page": "foo"})
|
resp = await client.post("/article", json={"name": "foo", "nb_page": "foo"})
|
||||||
|
a = await resp.text()
|
||||||
assert resp.status == 400
|
assert resp.status == 400
|
||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
assert await resp.json() == [
|
assert await resp.json() == [
|
||||||
|
@ -98,7 +98,7 @@ async def ensure_content_durability(client):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def generated_oas(aiohttp_client, loop) -> web.Application:
|
async def generated_oas(aiohttp_client, event_loop) -> web.Application:
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/pets", PetCollectionView)
|
app.router.add_view("/pets", PetCollectionView)
|
||||||
app.router.add_view("/pets/{id}", PetItemView)
|
app.router.add_view("/pets/{id}", PetItemView)
|
||||||
|
@ -68,7 +68,7 @@ async def test_post_an_article_with_wrong_type_field_should_return_an_error_mess
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
async def test_post_an_array_json_is_supported(aiohttp_client, loop):
|
async def test_post_an_array_json_is_supported(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleView)
|
app.router.add_view("/article", ArticleView)
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ async def test_post_an_object_json_to_a_list_model_should_return_an_error(
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
async def test_post_a_valid_article_should_return_the_parsed_type(aiohttp_client, loop):
|
async def test_post_a_valid_article_should_return_the_parsed_type(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleView)
|
app.router.add_view("/article", ArticleView)
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ async def test_get_article_with_valid_header_containing_hyphen_should_be_returne
|
|||||||
assert await resp.json() == {"signature": "2020-10-04T18:01:00"}
|
assert await resp.json() == {"signature": "2020-10-04T18:01:00"}
|
||||||
|
|
||||||
|
|
||||||
async def test_wrong_value_to_header_defined_with_str_enum(aiohttp_client, loop):
|
async def test_wrong_value_to_header_defined_with_str_enum(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/coord", ViewWithEnumType)
|
app.router.add_view("/coord", ViewWithEnumType)
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ async def test_wrong_value_to_header_defined_with_str_enum(aiohttp_client, loop)
|
|||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
|
|
||||||
|
|
||||||
async def test_correct_value_to_header_defined_with_str_enum(aiohttp_client, loop):
|
async def test_correct_value_to_header_defined_with_str_enum(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/coord", ViewWithEnumType)
|
app.router.add_view("/coord", ViewWithEnumType)
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ async def test_correct_value_to_header_defined_with_str_enum(aiohttp_client, loo
|
|||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
|
|
||||||
|
|
||||||
async def test_with_signature_group(aiohttp_client, loop):
|
async def test_with_signature_group(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleViewWithSignatureGroup)
|
app.router.add_view("/article", ArticleViewWithSignatureGroup)
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ async def test_get_article_with_multiple_value_for_qs_age_must_failed(
|
|||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
|
|
||||||
|
|
||||||
async def test_get_article_with_multiple_value_of_tags(aiohttp_client, loop):
|
async def test_get_article_with_multiple_value_of_tags(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleView)
|
app.router.add_view("/article", ArticleView)
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ async def test_get_article_with_multiple_value_of_tags(aiohttp_client, loop):
|
|||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
|
|
||||||
|
|
||||||
async def test_get_article_with_one_value_of_tags_must_be_a_list(aiohttp_client, loop):
|
async def test_get_article_with_one_value_of_tags_must_be_a_list(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleView)
|
app.router.add_view("/article", ArticleView)
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ async def test_get_article_with_one_value_of_tags_must_be_a_list(aiohttp_client,
|
|||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
|
|
||||||
|
|
||||||
async def test_get_article_without_required_field_page(aiohttp_client, loop):
|
async def test_get_article_without_required_field_page(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleViewWithPaginationGroup)
|
app.router.add_view("/article", ArticleViewWithPaginationGroup)
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ async def test_get_article_without_required_field_page(aiohttp_client, loop):
|
|||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
|
|
||||||
|
|
||||||
async def test_get_article_with_page(aiohttp_client, loop):
|
async def test_get_article_with_page(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleViewWithPaginationGroup)
|
app.router.add_view("/article", ArticleViewWithPaginationGroup)
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ async def test_get_article_with_page(aiohttp_client, loop):
|
|||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
|
|
||||||
|
|
||||||
async def test_get_article_with_page_and_page_size(aiohttp_client, loop):
|
async def test_get_article_with_page_and_page_size(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleViewWithPaginationGroup)
|
app.router.add_view("/article", ArticleViewWithPaginationGroup)
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ async def test_get_article_with_page_and_page_size(aiohttp_client, loop):
|
|||||||
assert resp.content_type == "application/json"
|
assert resp.content_type == "application/json"
|
||||||
|
|
||||||
|
|
||||||
async def test_get_article_with_page_and_wrong_page_size(aiohttp_client, loop):
|
async def test_get_article_with_page_and_wrong_page_size(aiohttp_client, event_loop):
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
app.router.add_view("/article", ArticleViewWithPaginationGroup)
|
app.router.add_view("/article", ArticleViewWithPaginationGroup)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user