diff options
author | Remco Burema <r.burema@ultimaker.com> | 2019-06-20 17:04:37 +0300 |
---|---|---|
committer | Remco Burema <r.burema@ultimaker.com> | 2019-06-20 17:04:37 +0300 |
commit | 53c387f34dfeadf1a8232939ffc6d55fcdbe487f (patch) | |
tree | f41642f45c72e84ae58867c6aa81013ba6bc18bc /tests/TestIntentManager.py | |
parent | 96c111553a111229d5e10bc2b6f86c0eb62cd412 (diff) |
Add TestIntentManager (mostly a dummy file), prevents future conflicts. [CURA-6091]
Diffstat (limited to 'tests/TestIntentManager.py')
-rw-r--r-- | tests/TestIntentManager.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/TestIntentManager.py b/tests/TestIntentManager.py new file mode 100644 index 0000000000..a30de04565 --- /dev/null +++ b/tests/TestIntentManager.py @@ -0,0 +1,38 @@ +from unittest.mock import MagicMock, patch + +import pytest + +from UM.Settings.ContainerRegistry import ContainerRegistry +from cura.Settings.ExtruderManager import ExtruderManager +from cura.Settings.MachineManager import MachineManager +from cura.Settings.IntentManager import IntentManager + +@pytest.fixture() +def global_stack(): + return MagicMock(name="Global Stack") + +@pytest.fixture() +def container_registry() -> ContainerRegistry: + return MagicMock(name = "ContainerRegistry") + + +@pytest.fixture() +def extruder_manager(application, container_registry) -> ExtruderManager: + if ExtruderManager.getInstance() is not None: + # Reset the data + ExtruderManager._ExtruderManager__instance = None + + with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=application)): + with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value=container_registry)): + manager = ExtruderManager() + return manager + + +@pytest.fixture() +def machine_manager(application, extruder_manager, container_registry, global_stack) -> MachineManager: + application.getExtruderManager = MagicMock(return_value = extruder_manager) + application.getGlobalContainerStack = MagicMock(return_value = global_stack) + with patch("cura.Settings.CuraContainerRegistry.CuraContainerRegistry.getInstance", MagicMock(return_value=container_registry)): + manager = MachineManager(application) + + return manager |