viktor.testing
mock_ParamsFromFile
- viktor.testing.mock_ParamsFromFile(controller)¶
Decorator that can be used for testing methods decorated with
viktor.core.ParamsFromFile
.Example:
import unittest from viktor.testing import mock_ParamsFromFile from app.my_entity.controller import MyEntityController class TestMyEntityController(unittest.TestCase): @mock_ParamsFromFile(MyEntityController) def test_process_file(self): file = File.from_data("abc") returned_dict = MyEntityController().process_file(file) self.assertDictEqual(returned_dict, {...})
- Parameters
controller (
Type
[ViktorController
]) – Controller class on which the ParamsFromFile should be mocked- Return type
Callable