aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTom Christie2015-02-25 11:36:05 +0000
committerTom Christie2015-02-25 11:36:05 +0000
commit90f1c04c6b59cc0cadbb5e36251b130d96307943 (patch)
tree04b34df246b784eb04baf27b49e33498319df2cb /tests
parentb69032f3a794bbc45974a6b362b186c494373ae1 (diff)
parent9cafdd1854ccd5215b7a188c5896fb498a59d725 (diff)
downloaddjango-rest-framework-90f1c04c6b59cc0cadbb5e36251b130d96307943.tar.bz2
Merge pull request #2595 from k4nar/fix_url_path
Fix url_path on dynamic routes for inherited viewsets. Fix #2583
Diffstat (limited to 'tests')
-rw-r--r--tests/test_routers.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/test_routers.py b/tests/test_routers.py
index 948c69bb..08c58ec7 100644
--- a/tests/test_routers.py
+++ b/tests/test_routers.py
@@ -302,12 +302,16 @@ class DynamicListAndDetailViewSet(viewsets.ViewSet):
return Response({'method': 'link2'})
+class SubDynamicListAndDetailViewSet(DynamicListAndDetailViewSet):
+ pass
+
+
class TestDynamicListAndDetailRouter(TestCase):
def setUp(self):
self.router = SimpleRouter()
- def test_list_and_detail_route_decorators(self):
- routes = self.router.get_routes(DynamicListAndDetailViewSet)
+ def _test_list_and_detail_route_decorators(self, viewset):
+ routes = self.router.get_routes(viewset)
decorator_routes = [r for r in routes if not (r.name.endswith('-list') or r.name.endswith('-detail'))]
MethodNamesMap = namedtuple('MethodNamesMap', 'method_name url_path')
@@ -336,3 +340,9 @@ class TestDynamicListAndDetailRouter(TestCase):
else:
method_map = 'get'
self.assertEqual(route.mapping[method_map], method_name)
+
+ def test_list_and_detail_route_decorators(self):
+ self._test_list_and_detail_route_decorators(DynamicListAndDetailViewSet)
+
+ def test_inherited_list_and_detail_route_decorators(self):
+ self._test_list_and_detail_route_decorators(SubDynamicListAndDetailViewSet)