Skip to content

Commit

Permalink
tests: Use basename='xxx' to set a unique basename (#342)
Browse files Browse the repository at this point in the history
* tests: Use basename='xxx' to set a unique basename

Since DRF 3.15.0 a unique basename must be used due
encode/django-rest-framework#8438

Fixes #341

* Update tests_app/tests/functional/mixins/detail_serializer_mixin/urls.py

---------

Co-authored-by: Asif Saif Uddin <[email protected]>
  • Loading branch information
tijuca and auvipy authored Sep 4, 2024
1 parent 7af1041 commit 3be38d5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@


viewset_router = routers.DefaultRouter()
viewset_router.register('comments', CommentViewSet)
viewset_router.register('comments-2', CommentWithoutDetailSerializerClassViewSet)
viewset_router.register('comments-3', CommentWithIdTwoViewSet)
viewset_router.register('comments-4', CommentWithIdTwoAndIdOneForDetailViewSet)
viewset_router.register('comments-5', CommentWithDetailSerializerAndNoArgsForGetQuerySetViewSet)
viewset_router.register('comments', CommentViewSet, basename='alt1')
viewset_router.register('comments-2', CommentWithoutDetailSerializerClassViewSet, basename='alt2')
viewset_router.register('comments-3', CommentWithIdTwoViewSet, basename='alt3')
viewset_router.register('comments-4', CommentWithIdTwoAndIdOneForDetailViewSet, basename='alt4')
viewset_router.register('comments-5', CommentWithDetailSerializerAndNoArgsForGetQuerySetViewSet, basename='alt5')

urlpatterns = viewset_router.urls
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@


viewset_router = routers.DefaultRouter()
viewset_router.register('comments', CommentViewSet)
viewset_router.register('comments-with-permissions', CommentViewSetWithPermissions)
viewset_router.register('comments', CommentViewSet, basename='alt1')
viewset_router.register('comments-with-permissions', CommentViewSetWithPermissions, basename='alt2')
urlpatterns = viewset_router.urls
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


viewset_router = routers.DefaultRouter()
viewset_router.register('comments', CommentViewSet)
viewset_router.register('comments-with-permissions', CommentViewSetWithPermissions)
viewset_router.register('users', UserViewSet)
viewset_router.register('comments', CommentViewSet, basename='alt1')
viewset_router.register('comments-with-permissions', CommentViewSetWithPermissions, basename='alt2')
viewset_router.register('users', UserViewSet, basename='alt3')
urlpatterns = viewset_router.urls
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


viewset_router = routers.DefaultRouter()
viewset_router.register('comments', CommentViewSet)
viewset_router.register('comments-without-paginate-by-param-attribute', CommentWithoutPaginateByParamViewSet)
viewset_router.register('comments-without-max-paginate-by-attribute', CommentWithoutMaxPaginateByAttributeViewSet)
viewset_router.register('comments', CommentViewSet, basename='1')
viewset_router.register('comments-without-paginate-by-param-attribute', CommentWithoutPaginateByParamViewSet, basename='2')
viewset_router.register('comments-without-max-paginate-by-attribute', CommentWithoutMaxPaginateByAttributeViewSet, basename='3')
urlpatterns = viewset_router.urls
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@


viewset_router = routers.DefaultRouter()
viewset_router.register('comments', CommentViewSet)
viewset_router.register('comments-permission-filter-backend', CommentViewSetPermissionFilterBackend)
viewset_router.register('comments-without-hiding-forbidden-objects', CommentViewSetWithoutHidingForbiddenObjects)
viewset_router.register('comments', CommentViewSet, basename='alt1')
viewset_router.register('comments-permission-filter-backend', CommentViewSetPermissionFilterBackend, basename='alt2')
viewset_router.register('comments-without-hiding-forbidden-objects', CommentViewSetWithoutHidingForbiddenObjects, basename='alt3')
viewset_router.register(
'comments-without-hiding-forbidden-objects-permission-filter-backend',
CommentViewSetWithoutHidingForbiddenObjectsPermissionFilterBackend
CommentViewSetWithoutHidingForbiddenObjectsPermissionFilterBackend,
basename='alt4'
)
urlpatterns = viewset_router.urls

0 comments on commit 3be38d5

Please sign in to comment.