From a5d91139ef7424eac05a00ba3ff4d58a9337c981 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 24 Mar 2017 17:49:14 +0100 Subject: [PATCH] Add tests for setQualityChangesById One for when the ID exists, and one for when it doesn't. Contributes to issue CURA-3497. --- tests/Settings/TestExtruderStack.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/Settings/TestExtruderStack.py b/tests/Settings/TestExtruderStack.py index 3a74f36efa..12c0ae08a2 100644 --- a/tests/Settings/TestExtruderStack.py +++ b/tests/Settings/TestExtruderStack.py @@ -321,4 +321,21 @@ def test_setQualityByIdExists(extruder_stack, container_registry): ## Tests setting qualities by specifying an ID of a quality that doesn't exist. def test_setQualityByIdDoesntExist(extruder_stack): with pytest.raises(KeyError): - extruder_stack.setQualityById("some_quality") #Container registry is empty now. \ No newline at end of file + extruder_stack.setQualityById("some_quality") #Container registry is empty now. + +## Tests setting quality changes by specifying an ID of a quality change that +# exists. +def test_setQualityChangesByIdExists(extruder_stack, container_registry): + original_container_registry = UM.Settings.ContainerStack._containerRegistry + UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of. + + extruder_stack.setQualityChangesById("some_quality_changes") #The container registry always has a container with the ID. + + #Restore. + UM.Settings.ContainerStack._containerRegistry = original_container_registry + +## Tests setting quality changes by specifying an ID of a quality change that +# doesn't exist. +def test_setQualityChangesByIdDoesntExist(extruder_stack): + with pytest.raises(KeyError): + extruder_stack.setQualityChangesById("some_quality_changes") #Container registry is empty now. \ No newline at end of file