def test_status_action_methods_manager(self):

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

            def action_method(self, data, *args, **kwargs):
                '''
                Return back status as 'created' and data in 'result' key
                '''
                return {'status': 'created', 'result': 'some_data'}

            def accept_method(self, data, pk=None, **kwargs):
                """
                assert if self.session is available
                """
                assert self.session is not None

                return {'status': 'accepted'}

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

        class MockViewSet(AlchemyModelViewSet, ManagerMixin):
            manager_class = MockManager

        mock_request = mock.Mock()
        mock_request.data = {}

        viewset = MockViewSet()
        r = viewset.action_method(mock_request)
        self.assertEqual(r.status_code, status.HTTP_201_CREATED)

        r = viewset.accept_method(mock_request)
        self.assertEqual(r.status_code, status.HTTP_202_ACCEPTED)

        r = viewset.update_method(mock_request)
        self.assertEqual(r.status_code, status.HTTP_200_OK)
Test if action methods return appropriate status
dataset/ETHPy150Open dealertrack/djangorest-alchemy/djangorest_alchemy/tests/test_viewsets.py/TestAlchemyViewSetUnit.test_status_action_methods_manager