36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
|
|
"""Tests for BUG-036 fix — GET /api/v1/workflows/instances returned 500.
|
||
|
|
|
||
|
|
Root cause: the route passed ``user_id``/``is_system_admin`` which the service
|
||
|
|
signature did not accept -> TypeError -> 500 on every call.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
from tests.conftest import ORIGIN_HEADER, login_client, seed_tenant_and_users
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.asyncio
|
||
|
|
async def test_list_instances_returns_200(client, db_session):
|
||
|
|
"""GET /api/v1/workflows/instances must return 200 (was 500 before fix)."""
|
||
|
|
await seed_tenant_and_users(db_session)
|
||
|
|
await login_client(client, "admin@tenanta.com")
|
||
|
|
|
||
|
|
resp = await client.get("/api/v1/workflows/instances", headers=ORIGIN_HEADER)
|
||
|
|
assert resp.status_code == 200, resp.text
|
||
|
|
data = resp.json()
|
||
|
|
assert "items" in data and "total" in data
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.asyncio
|
||
|
|
async def test_list_instances_status_filter_returns_200(client, db_session):
|
||
|
|
"""Status filter variant also works after the signature fix."""
|
||
|
|
await seed_tenant_and_users(db_session)
|
||
|
|
await login_client(client, "admin@tenanta.com")
|
||
|
|
|
||
|
|
resp = await client.get(
|
||
|
|
"/api/v1/workflows/instances?status=running", headers=ORIGIN_HEADER
|
||
|
|
)
|
||
|
|
assert resp.status_code == 200, resp.text
|