

def test_action_methods_manager_mixin(self):
    '\n        Test if action methods specified on managers using action_methods\n        class field are registered with viewset\n        '

    class MockManager(SessionMixin, AlchemyModelManager):
        model_class = mock.Mock()
        action_methods = {
            'method_name': ['POST', 'DELETE'],
        }

        def method_name(self, data, pk=None, **kwargs):
            return {
                'status': 'created',
            }

    class MockViewSet(viewsets.ViewSet, ManagerMixin):
        manager_class = MockManager
    viewset = MockViewSet()
    self.assertTrue(hasattr(viewset, 'method_name'))
    method = getattr(manager_class, 'method_name')
    self.assertTrue(hasattr(method, 'bind_to_methods'))

dataset/ETHPy150Open dealertrack/djangorest-alchemy/djangorest_alchemy/tests/test_viewsets.py TestAlchemyViewSetUnit.test_action_methods_manager_mixin/VarMisuse@116/204 `viewset`->`manager_class`