style(v2): normalize execution integration test

This commit is contained in:
2026-07-27 22:07:41 +02:00
parent be56228748
commit 8e5dd87ff6
+3 -9
View File
@@ -12,9 +12,7 @@ PASSWORD = "correct-horse-battery-staple"
async def login(client: httpx.AsyncClient) -> dict[str, str]: async def login(client: httpx.AsyncClient) -> dict[str, str]:
response = await client.post( response = await client.post("/api/v2/setup", json={"username": "admin", "password": PASSWORD})
"/api/v2/setup", json={"username": "admin", "password": PASSWORD}
)
assert response.status_code == 201 assert response.status_code == 201
return {"X-CSRF-Token": client.cookies["backup_tool_csrf"]} return {"X-CSRF-Token": client.cookies["backup_tool_csrf"]}
@@ -49,9 +47,7 @@ async def test_local_source_probe_archive_and_repository_targeted_job(
async with app.state.engine.begin() as connection: async with app.state.engine.begin() as connection:
await connection.run_sync(Base.metadata.create_all) await connection.run_sync(Base.metadata.create_all)
transport = httpx.ASGITransport(app=app) transport = httpx.ASGITransport(app=app)
async with httpx.AsyncClient( async with httpx.AsyncClient(transport=transport, base_url="https://test") as client:
transport=transport, base_url="https://test"
) as client:
headers = await login(client) headers = await login(client)
repository = await client.post( repository = await client.post(
"/api/v2/repositories", "/api/v2/repositories",
@@ -99,9 +95,7 @@ async def test_local_source_probe_archive_and_repository_targeted_job(
) )
assert duplicate.status_code == 409 assert duplicate.status_code == 409
assert duplicate.json()["code"] == "execution_active" assert duplicate.json()["code"] == "execution_active"
polled = await client.get( polled = await client.get(f"/api/v2/executions/{execution.json()['id']}", headers=headers)
f"/api/v2/executions/{execution.json()['id']}", headers=headers
)
assert polled.status_code == 200 assert polled.status_code == 200
assert polled.json()["state"] == "queued" assert polled.json()["state"] == "queued"
cancellation = await client.post( cancellation = await client.post(