Add @extend_schema decorators to moderation ViewSet actions

- Add drf_spectacular imports (extend_schema, OpenApiResponse, inline_serializer)
- Annotate claim action with response schemas for 200/404/409/400
- Annotate unclaim action with response schemas for 200/403/400
- Annotate approve action with request=None and response schemas
- Annotate reject action with reason request body schema
- Annotate escalate action with reason request body schema
- All actions tagged with 'Moderation' for API docs grouping
This commit is contained in:
pacnpal
2026-01-13 19:34:41 -05:00
parent d631f3183c
commit 4140a0d8e7
18 changed files with 526 additions and 692 deletions

View File

@@ -3,7 +3,7 @@ Comprehensive tests for the moderation app.
This module contains tests for:
- EditSubmission state machine transitions
- PhotoSubmission state machine transitions
- EditSubmission with submission_type="PHOTO" (photo submissions)
- ModerationReport state machine transitions
- ModerationQueue state machine transitions
- BulkOperation state machine transitions
@@ -39,7 +39,6 @@ from ..models import (
ModerationAction,
ModerationQueue,
ModerationReport,
PhotoSubmission,
)
User = get_user_model()
@@ -1132,14 +1131,17 @@ class ModerationActionTests(TestCase):
# ============================================================================
# PhotoSubmission FSM Transition Tests
# EditSubmission PHOTO Type FSM Transition Tests
# ============================================================================
class PhotoSubmissionTransitionTests(TestCase):
"""Comprehensive tests for PhotoSubmission FSM transitions.
class PhotoEditSubmissionTransitionTests(TestCase):
"""Comprehensive tests for EditSubmission with submission_type='PHOTO' FSM transitions.
Note: All approve/reject/escalate transitions require CLAIMED state first.
These tests validate that photo submissions (using the unified EditSubmission model)
have correct FSM behavior.
"""
def setUp(self):
@@ -1169,13 +1171,15 @@ class PhotoSubmissionTransitionTests(TestCase):
)
def _create_submission(self, status="PENDING"):
"""Helper to create a PhotoSubmission with proper CloudflareImage."""
submission = PhotoSubmission.objects.create(
"""Helper to create an EditSubmission with submission_type='PHOTO' and proper CloudflareImage."""
submission = EditSubmission.objects.create(
user=self.user,
content_type=self.content_type,
object_id=self.operator.id,
submission_type="PHOTO", # Unified model
photo=self.mock_image,
caption="Test Photo",
changes={}, # Photos use empty changes
status="PENDING", # Always create as PENDING first
)