mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 14:55:18 -05:00
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:
@@ -13,11 +13,10 @@ from django.test import RequestFactory, TestCase
|
||||
from apps.moderation.admin import (
|
||||
EditSubmissionAdmin,
|
||||
HistoryEventAdmin,
|
||||
PhotoSubmissionAdmin,
|
||||
StateLogAdmin,
|
||||
moderation_site,
|
||||
)
|
||||
from apps.moderation.models import EditSubmission, PhotoSubmission
|
||||
from apps.moderation.models import EditSubmission
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
@@ -101,32 +100,7 @@ class TestEditSubmissionAdmin(TestCase):
|
||||
assert "bulk_escalate" in actions
|
||||
|
||||
|
||||
class TestPhotoSubmissionAdmin(TestCase):
|
||||
"""Tests for PhotoSubmissionAdmin class."""
|
||||
|
||||
def setUp(self):
|
||||
self.factory = RequestFactory()
|
||||
self.site = AdminSite()
|
||||
self.admin = PhotoSubmissionAdmin(model=PhotoSubmission, admin_site=self.site)
|
||||
|
||||
def test_list_display_includes_preview(self):
|
||||
"""Verify photo preview is in list_display."""
|
||||
assert "photo_preview" in self.admin.list_display
|
||||
|
||||
def test_list_select_related(self):
|
||||
"""Verify select_related is configured."""
|
||||
assert "user" in self.admin.list_select_related
|
||||
assert "content_type" in self.admin.list_select_related
|
||||
assert "handled_by" in self.admin.list_select_related
|
||||
|
||||
def test_moderation_actions_registered(self):
|
||||
"""Verify moderation actions are registered."""
|
||||
request = self.factory.get("/admin/")
|
||||
request.user = User(is_superuser=True)
|
||||
|
||||
actions = self.admin.get_actions(request)
|
||||
assert "bulk_approve" in actions
|
||||
assert "bulk_reject" in actions
|
||||
# PhotoSubmissionAdmin tests removed - model consolidated into EditSubmission
|
||||
|
||||
|
||||
class TestStateLogAdmin(TestCase):
|
||||
@@ -200,9 +174,7 @@ class TestRegisteredModels(TestCase):
|
||||
"""Verify EditSubmission is registered with moderation site."""
|
||||
assert EditSubmission in moderation_site._registry
|
||||
|
||||
def test_photo_submission_registered(self):
|
||||
"""Verify PhotoSubmission is registered with moderation site."""
|
||||
assert PhotoSubmission in moderation_site._registry
|
||||
# PhotoSubmission registration test removed - model consolidated into EditSubmission
|
||||
|
||||
def test_state_log_registered(self):
|
||||
"""Verify StateLog is registered with moderation site."""
|
||||
|
||||
Reference in New Issue
Block a user