34 lines
858 B
Python
34 lines
858 B
Python
from __future__ import annotations
|
|
|
|
from uuid import UUID, uuid4
|
|
|
|
import pytest
|
|
|
|
from dataloader.api.v1.exceptions import JobNotFoundError
|
|
from dataloader.api.v1.router import cancel_job, get_status
|
|
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)
|