27 lines
770 B
Python
27 lines
770 B
Python
from app.models import ApplicationCreate
|
|
from app.repositories.applications import ApplicationRepository
|
|
|
|
|
|
def test_repository_create_and_status_update(database):
|
|
repo = ApplicationRepository(database)
|
|
created = repo.create(
|
|
ApplicationCreate(
|
|
customer_id=1,
|
|
customer_name="Alice",
|
|
chat_id=42,
|
|
category="A",
|
|
description="Need help",
|
|
attachments_json="[]",
|
|
source="test",
|
|
)
|
|
)
|
|
assert created.id > 0
|
|
assert created.status == "new"
|
|
|
|
updated = repo.update_status(created.id, "in_progress", actor="tester")
|
|
assert updated is not None
|
|
assert updated.status == "in_progress"
|
|
|
|
events = repo.get_events(created.id)
|
|
assert len(events) >= 2
|
|
|