Model/backend/app/tests/tasks/test_get_task.py
2026-03-06 10:55:40 +00:00

61 lines
1.6 KiB
Python

from datetime import datetime
import uuid
from sqlmodel import Session
from backend.app.db.models.tasks import SourceEnum, Task
def test_get_task_by_source(db_session: Session):
# arrange
current_categorisation_task = Task(
id=uuid.uuid4(),
task_source="",
job_started=datetime(2026, 1, 1, 9, 0, 0),
job_completed=None,
status="in progress",
service="plan_categorisation",
updated_at=datetime(2026, 1, 1, 9, 0, 0),
source=SourceEnum.PORTFOLIO,
source_id="100",
)
previous_categorisation_task = Task(
id=uuid.uuid4(),
task_source="",
job_started=datetime(2025, 12, 31, 9, 0, 0),
job_completed=datetime(2025, 12, 31, 9, 10, 0),
status="complete",
service="plan_categorisation",
updated_at=datetime(2025, 12, 31, 9, 10, 0),
source=SourceEnum.PORTFOLIO,
source_id="100",
)
other_portfolio_categorisation_task = Task(
id=uuid.uuid4(),
task_source="",
job_started=datetime(2026, 1, 1, 9, 0, 0),
job_completed=None,
status="in progress",
service="plan_categorisation",
updated_at=datetime(2026, 1, 1, 9, 0, 0),
source=SourceEnum.PORTFOLIO,
source_id="101",
)
engine_task = Task(
id=uuid.uuid4(),
task_source="",
job_started=datetime(2026, 1, 1, 9, 0, 0),
job_completed=None,
status="in progress",
service="plan_engine",
updated_at=datetime(2026, 1, 1, 9, 0, 0),
source=SourceEnum.PORTFOLIO,
source_id="100",
)
# act
# assert