Skip to content

Commit

Permalink
Add test for fix against wagtail#10411
Browse files Browse the repository at this point in the history
  • Loading branch information
mgax authored and lb- committed Jul 6, 2023
1 parent 3da4b68 commit 60ed6d2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wagtail/api/v2/tests/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,11 @@ def test_issue_3967(self):
response = self.get_response()
self.assertEqual(response.status_code, 200)

def test_issue_10411(self):
# Bug with removing meta fields from API
response = self.client.get(reverse("testapp_api_v2:test_issue_10411:listing"))
self.assertEqual(response.status_code, 200)


class TestPageListingSearch(WagtailTestUtils, TransactionTestCase):
fixtures = ["demosite.json"]
Expand Down
5 changes: 5 additions & 0 deletions wagtail/test/testapp/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from django.urls import path

from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.test.testapp import views

api_router = WagtailAPIRouter("testapp_api_v2")
api_router.register_endpoint("test_issue_10411", views.Test10411ApiViewSet)

urlpatterns = [
path("bob-only-zone", views.bob_only_zone, name="testapp_bob_only_zone"),
path("messages/", views.message_test, name="testapp_message_test"),
Expand All @@ -14,4 +18,5 @@
views.TestDeleteView.as_view(),
name="testapp_generic_delete",
),
path("api/v2/", api_router.urls),
]
5 changes: 5 additions & 0 deletions wagtail/test/testapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from wagtail.admin import messages
from wagtail.admin.auth import user_passes_test
from wagtail.admin.views.generic import DeleteView, EditView, IndexView
from wagtail.api.v2.views import PagesAPIViewSet
from wagtail.contrib.forms.views import SubmissionsListView

from .models import ModelWithStringTypePrimaryKey
Expand Down Expand Up @@ -81,3 +82,7 @@ class TestDeleteView(DeleteView):
delete_url_name = "testapp_generic_delete"
success_message = gettext_lazy("User '%(object)s' updated.")
page_title = gettext_lazy("test delete view")


class Test10411ApiViewSet(PagesAPIViewSet):
meta_fields = []

0 comments on commit 60ed6d2

Please sign in to comment.