예제 #1
0
    def test_factory(self):
        func = action_export_factory('csv')
        assert func.__name__ == 'export_csv_func'

        func = action_export_factory('xlsx')
        assert func.__name__ == 'export_xlsx_func'

        with pytest.raises(ImproperlyConfigured):
            action_export_factory('test')
예제 #2
0
 def test_factory_call_xlsx(self, func_mock, func_mock2):
     func = action_export_factory('xlsx')
     func()
     assert func_mock.call_count == 0
     assert func_mock2.call_count == 1
예제 #3
0
 def test_factory_call_csv(self, func_mock, func_mock2):
     func = action_export_factory('csv')
     func()
     assert func_mock.call_count == 1
     assert func_mock2.call_count == 0