

def test_action_methods_manager_exception(self):
    '\n        Test if action methods specified on managers raise exceptions\n        and are caught properly\n        '

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

        def method_name(self, data, pk=None, **kwargs):
            raise ValueError('Dummy exception')

    class MockViewSet(AlchemyModelViewSet, ManagerMixin):
        manager_class = MockManager
    mock_request = mock.Mock()
    mock_request.data = {
        
    }
    viewset = MockViewSet()
    self.assertRaises(ValueError, viewset.method_name, mock_request)

dataset/ETHPy150Open dealertrack/djangorest-alchemy/djangorest_alchemy/tests/test_viewsets.py TestAlchemyViewSetUnit.test_action_methods_manager_exception/original