mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-14 13:46:59 +03:00
Rename router collection test case
This commit is contained in:
parent
8d521c068a
commit
f022743078
|
@ -216,7 +216,7 @@ class TestActionAppliedToExistingRoute(TestCase):
|
||||||
self.router.urls
|
self.router.urls
|
||||||
|
|
||||||
|
|
||||||
class StaticAndDynamicViewSet(viewsets.ViewSet):
|
class CollectionAndDynamicViewSet(viewsets.ViewSet):
|
||||||
def list(self, request, *args, **kwargs):
|
def list(self, request, *args, **kwargs):
|
||||||
return Response({'method': 'list'})
|
return Response({'method': 'list'})
|
||||||
|
|
||||||
|
@ -237,12 +237,12 @@ class StaticAndDynamicViewSet(viewsets.ViewSet):
|
||||||
return Response({'method': 'link2'})
|
return Response({'method': 'link2'})
|
||||||
|
|
||||||
|
|
||||||
class TestStaticAndDynamicRouter(TestCase):
|
class TestCollectionAndDynamicRouter(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.router = SimpleRouter()
|
self.router = SimpleRouter()
|
||||||
|
|
||||||
def test_link_and_action_decorator(self):
|
def test_link_and_action_decorator(self):
|
||||||
routes = self.router.get_routes(StaticAndDynamicViewSet)
|
routes = self.router.get_routes(CollectionAndDynamicViewSet)
|
||||||
decorator_routes = [r for r in routes if not (r.name.endswith('-list') or r.name.endswith('-detail'))]
|
decorator_routes = [r for r in routes if not (r.name.endswith('-list') or r.name.endswith('-detail'))]
|
||||||
# Make sure all these endpoints exist and none have been clobbered
|
# Make sure all these endpoints exist and none have been clobbered
|
||||||
for i, endpoint in enumerate(['collection_action', 'collection_link', 'dynamic_action', 'dynamic_link']):
|
for i, endpoint in enumerate(['collection_action', 'collection_link', 'dynamic_action', 'dynamic_link']):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user