"""Tests for the appreciation 3-state lifecycle realignment.""" import pytest from django.test import TestCase from django.urls import reverse, NoReverseMatch from apps.appreciation.models import AppreciationStatus, VALID_APPRECIATION_TRANSITIONS class TestAppreciationThreeStateLifecycle(TestCase): """Appreciation has exactly 3 statuses: DRAFT, ACTIVATED, SENT.""" def test_only_three_statuses_exist(self): choices = [value for value, _ in AppreciationStatus.choices] assert set(choices) == {"draft", "activated", "sent"}, \ f"Expected exactly 3 statuses, got: {choices}" def test_no_ai_analyzed_or_acknowledged(self): assert not hasattr(AppreciationStatus, "AI_ANALYZED"), \ "AI_ANALYZED should be removed" assert not hasattr(AppreciationStatus, "ACKNOWLEDGED"), \ "ACKNOWLEDGED should be removed" def test_sent_is_terminal(self): """SENT has no outgoing transitions.""" assert VALID_APPRECIATION_TRANSITIONS.get(AppreciationStatus.SENT) == set(), \ "SENT should be terminal" def test_activated_can_go_to_sent(self): """ACTIVATED transitions directly to SENT (no AI_ANALYZED intermediate).""" assert AppreciationStatus.SENT in \ VALID_APPRECIATION_TRANSITIONS[AppreciationStatus.ACTIVATED] class TestAppreciationRemovedUrls(TestCase): """The acknowledge and send-dept-reminder URL routes are gone.""" def test_acknowledge_url_does_not_resolve(self): with pytest.raises(NoReverseMatch): reverse("appreciation:appreciation_acknowledge", kwargs={"pk": "00000000-0000-0000-0000-000000000000"}) def test_send_dept_reminder_url_does_not_resolve(self): with pytest.raises(NoReverseMatch): reverse("appreciation:appreciation_send_dept_reminder", kwargs={"pk": "00000000-0000-0000-0000-000000000000"})