dataloader/tests/integration_tests/test_api_router_not_found.py

34 lines
899 B
Python

# tests/unit/test_api_router_not_found.py
from __future__ import annotations
import pytest
from uuid import uuid4, UUID
from dataloader.api.v1.router import get_status, cancel_job
from dataloader.api.v1.exceptions import JobNotFoundError
from dataloader.api.v1.schemas import JobStatusResponse
class _FakeSvc:
async def status(self, job_id: UUID) -> JobStatusResponse | None:
return None
async def cancel(self, job_id: UUID) -> JobStatusResponse | None:
return None
@pytest.mark.unit
@pytest.mark.asyncio
async def test_router_get_status_raises_job_not_found():
svc = _FakeSvc()
with pytest.raises(JobNotFoundError):
await get_status(uuid4(), svc=svc)
@pytest.mark.unit
@pytest.mark.asyncio
async def test_router_cancel_raises_job_not_found():
svc = _FakeSvc()
with pytest.raises(JobNotFoundError):
await cancel_job(uuid4(), svc=svc)