ppt-tool/backend/tests/test_review_workflow.py
Vadym Samoilenko 76a4e41e3b Phase 7: Testing Suite — backend unit tests + Cypress E2E framework
Backend:
- conftest with async SQLite DB, factory fixtures for all models
- pytest-asyncio config in pyproject.toml
- Tests: auth (JWT, dev login), RBAC (access service), audit (query, export),
  brand enforcement (colors, fonts, logos, contrast), retention (cleanup, purge),
  content intelligence (regex classifiers), slide mapping, review workflow,
  analytics data queries

Frontend:
- Cypress E2E config with baseUrl and viewport settings
- Custom commands (devLogin, createPresentation)
- E2E specs: login flow, wizard navigation, admin panel, review workflow
- Test scripts in package.json

Infrastructure:
- Makefile: test-e2e and test-all targets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:49:23 +00:00

35 lines
1.3 KiB
Python

"""Tests for review workflow: status transitions and validation."""
import pytest
from api.v1.ppt.endpoints.review import VALID_TRANSITIONS, VALID_STATUSES
class TestStatusTransitions:
def test_valid_statuses(self):
assert VALID_STATUSES == {"draft", "in_review", "approved"}
def test_draft_can_go_to_in_review(self):
assert "in_review" in VALID_TRANSITIONS["draft"]
def test_draft_cannot_go_to_approved_directly(self):
assert "approved" not in VALID_TRANSITIONS["draft"]
def test_in_review_can_go_to_approved(self):
assert "approved" in VALID_TRANSITIONS["in_review"]
def test_in_review_can_go_back_to_draft(self):
assert "draft" in VALID_TRANSITIONS["in_review"]
def test_approved_can_go_back_to_draft(self):
assert "draft" in VALID_TRANSITIONS["approved"]
def test_approved_cannot_go_to_in_review(self):
assert "in_review" not in VALID_TRANSITIONS["approved"]
def test_all_statuses_have_transition_rules(self):
for status in VALID_STATUSES:
assert status in VALID_TRANSITIONS
def test_no_self_transitions(self):
for status, targets in VALID_TRANSITIONS.items():
assert status not in targets, f"{status} should not transition to itself"