def test_action_methods_manager_mixin(self):

        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(viewset, 'method_name')
        # DRF looks for methods with this attr
        self.assertTrue(hasattr(method, 'bind_to_methods'))
Test if action methods specified on managers using action_methods
dataset/ETHPy150Open dealertrack/djangorest-alchemy/djangorest_alchemy/tests/test_viewsets.py/TestAlchemyViewSetUnit.test_action_methods_manager_mixin