

def test_manager_factory(self):
    '\n        Test if manager_factory returns back appropriate instance\n        This shows how you can override manager_factory\n        and instantiate your own manager\n        '

    class MockManager(AlchemyModelManager):
        model_class = mock.Mock()

        def __init__(self, *args, **kwargs):
            self.session = mock.Mock()
            super(MockManager, self).__init__(*args, **kwargs)

    class MockViewSet(AlchemyModelViewSet):

        def manager_factory(self, *args, **kwargs):
            return MockManager()
    viewset = MockViewSet()
    self.assertIsInstance(viewset.manager_factory(), MockManager)

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