mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
Add failing test
This commit is contained in:
parent
ddfb9672ae
commit
12918fa541
|
@ -146,6 +146,15 @@ class InitializeViewSetsTestCase(TestCase):
|
|||
self.assertIn(attribute, dir(view))
|
||||
|
||||
|
||||
class ThingWithMapping:
|
||||
def __init__(self):
|
||||
self.mapping = {}
|
||||
|
||||
|
||||
class ActionViewSetWithMapping(ActionViewSet):
|
||||
mapper = ThingWithMapping()
|
||||
|
||||
|
||||
class GetExtraActionsTests(TestCase):
|
||||
|
||||
def test_extra_actions(self):
|
||||
|
@ -161,6 +170,18 @@ class GetExtraActionsTests(TestCase):
|
|||
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
def test_should_only_return_decorated_methods(self):
|
||||
view = ActionViewSetWithMapping()
|
||||
actual = [action.__name__ for action in view.get_extra_actions()]
|
||||
expected = [
|
||||
'custom_detail_action',
|
||||
'custom_list_action',
|
||||
'detail_action',
|
||||
'list_action',
|
||||
'unresolvable_detail_action',
|
||||
]
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='tests.test_viewsets')
|
||||
class GetExtraActionUrlMapTests(TestCase):
|
||||
|
|
Loading…
Reference in New Issue
Block a user