diff options
author | Remco Burema <r.burema@ultimaker.com> | 2019-06-28 13:10:39 +0300 |
---|---|---|
committer | Remco Burema <r.burema@ultimaker.com> | 2019-06-28 13:10:39 +0300 |
commit | 810fee37eb39c52cdb42b705e35e8ffa85e81725 (patch) | |
tree | 0a8352fc1137c67286e9838a1c0fff3236ec26df /tests/TestIntentManager.py | |
parent | 6b918dbd1dabc49a894da35ab15b2c09369b4e33 (diff) |
Start to test other IntentManager functions.
Very rudimentary at the moment, need to split the method into 3, and make a class for the setup.
This also uncovered that the currentAvailableIntents doesn't (unless the global stack is missing) retrun any default intents, while currentAvailableIntentCategories does do that.
Since it's not clear how we're going to handle that right now, I made a TODO in the code, which of course will have to be fixed before this/these branch/es are merged.
part of CURA-6091
Diffstat (limited to 'tests/TestIntentManager.py')
-rw-r--r-- | tests/TestIntentManager.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/tests/TestIntentManager.py b/tests/TestIntentManager.py index af5a2437c3..1012f8e2eb 100644 --- a/tests/TestIntentManager.py +++ b/tests/TestIntentManager.py @@ -50,6 +50,8 @@ def test_intentCategories(application, intent_manager, container_registry): def test_currentAvailableIntents(application, extruder_manager, quality_manager, intent_manager, container_registry, global_stack): + # This also tests 'currentAvailableIntentCategories' and 'selectIntent' since the methods are so similar + mocked_qualitygroup_metadata = { "normal": QualityGroup("um3_aa4_pla_normal", "normal"), "abnorm": QualityGroup("um3_aa4_pla_abnorm", "abnorm")} # type:Dict[str, QualityGroup] @@ -88,17 +90,22 @@ def test_currentAvailableIntents(application, extruder_manager, quality_manager, with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value=application)): with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value=container_registry)): with patch("cura.Settings.ExtruderManager.ExtruderManager.getInstance", MagicMock(return_value=extruder_manager)): + intents = intent_manager.currentAvailableIntents() assert ("smooth", "normal") in intents assert ("strong", "abnorm") in intents - assert len(intents) == 2 - - -def test_currentAvailableIntentCategories(application, quality_manager, intent_manager, container_registry): - # def currentAvailableIntentCategories(self) -> List[str]: - pass - - -def test_selectIntent(application, intent_manager, container_registry): - # def selectIntent(self, intent_category, quality_type) -> None: - pass + #assert ("default", "normal") in intents # Pending to-do in 'IntentManager'. + #assert ("default", "abnorm") in intents # Pending to-do in 'IntentManager'. + assert len(intents) == 2 # Or 4? pending to-do in 'IntentManager'. + + categories = intent_manager.currentAvailableIntentCategories() + assert "default" in categories # Currently inconsistent with 'currentAvailableIntents'! + assert "smooth" in categories + assert "strong" in categories + assert len(categories) == 3 + + for intent, quality in intents: + intent_manager.selectIntent(intent, quality) + assert extruder_stack_a.intent is not None + assert extruder_stack_b.intent is not None + # ... need MachineManager for this, split up methods anyway -> make into class, see examples others |