mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
update dependencies and refactor stuff api
This commit is contained in:
@@ -17,7 +17,7 @@ pytestmark = pytest.mark.asyncio
|
||||
),
|
||||
),
|
||||
)
|
||||
async def test_add_configuration(client: AsyncClient, payload: dict, status_code: int):
|
||||
async def test_add_stuff(client: AsyncClient, payload: dict, status_code: int):
|
||||
response = await client.post("/stuff", json=payload)
|
||||
assert response.status_code == status_code
|
||||
assert payload["name"] == response.json()["name"]
|
||||
@@ -32,10 +32,10 @@ async def test_add_configuration(client: AsyncClient, payload: dict, status_code
|
||||
),
|
||||
),
|
||||
)
|
||||
async def test_get_configuration(client: AsyncClient, payload: dict, status_code: int):
|
||||
async def test_get_stuff(client: AsyncClient, payload: dict, status_code: int):
|
||||
await client.post("/stuff", json=payload)
|
||||
name = payload["name"]
|
||||
response = await client.get(f"/stuff/?name={name}")
|
||||
response = await client.get(f"/stuff/{name}")
|
||||
assert response.status_code == status_code
|
||||
assert payload["name"] == response.json()["name"]
|
||||
assert UUID(response.json()["id"])
|
||||
@@ -50,10 +50,10 @@ async def test_get_configuration(client: AsyncClient, payload: dict, status_code
|
||||
),
|
||||
),
|
||||
)
|
||||
async def test_delete_configuration(client: AsyncClient, payload: dict, status_code: int):
|
||||
async def test_delete_stuff(client: AsyncClient, payload: dict, status_code: int):
|
||||
response = await client.post("/stuff", json=payload)
|
||||
name = response.json()["name"]
|
||||
response = await client.delete(f"/stuff/?name={name}")
|
||||
response = await client.delete(f"/stuff/{name}")
|
||||
assert response.status_code == status_code
|
||||
|
||||
|
||||
@@ -75,12 +75,12 @@ async def test_delete_configuration(client: AsyncClient, payload: dict, status_c
|
||||
),
|
||||
),
|
||||
)
|
||||
async def test_update_configuration(
|
||||
async def test_update_stuff(
|
||||
client: AsyncClient, payload: dict, status_code: int, patch_payload: dict, patch_status_code: int
|
||||
):
|
||||
await client.post("/stuff/", json=payload)
|
||||
await client.post("/stuff", json=payload)
|
||||
name = payload["name"]
|
||||
response = await client.patch(f"/stuff/?name={name}", json=patch_payload)
|
||||
response = await client.patch(f"/stuff/{name}", json=patch_payload)
|
||||
assert response.status_code == patch_status_code
|
||||
response = await client.get(f"/stuff/?name={name}")
|
||||
response = await client.get(f"/stuff/{name}")
|
||||
assert patch_payload["description"] == response.json()["description"]
|
||||
|
||||
Reference in New Issue
Block a user