refactor(tests): extract CRUD/query logic to test_crud_service, router delegates to service with domain exceptions
This commit is contained in:
@@ -477,15 +477,15 @@ def test_evidence_team_separation():
|
||||
|
||||
|
||||
def test_red_edit_allowed_in_draft_and_red_executing():
|
||||
"""Verify the red update router checks that state is draft or red_executing."""
|
||||
from app.routers.tests import update_test_red
|
||||
"""Verify the red update checks that state is draft or red_executing."""
|
||||
from app.services.test_crud_service import update_test_red
|
||||
import inspect
|
||||
source = inspect.getsource(update_test_red)
|
||||
|
||||
# The function must guard against states other than draft/red_executing
|
||||
# The service must guard against states other than draft/red_executing
|
||||
assert "draft" in source, "Red update must allow draft state"
|
||||
assert "red_executing" in source, "Red update must allow red_executing state"
|
||||
assert "400" in source or "HTTP_400_BAD_REQUEST" in source, "Red update must return 400 for invalid state"
|
||||
assert "BusinessRuleViolation" in source, "Must raise domain exception for invalid state (mapped to 400)"
|
||||
|
||||
|
||||
# ===========================================================================
|
||||
|
||||
Reference in New Issue
Block a user