diff --git a/tests/Settings/TestGlobalStack.py b/tests/Settings/TestGlobalStack.py index 54988461cd..405edf3759 100644 --- a/tests/Settings/TestGlobalStack.py +++ b/tests/Settings/TestGlobalStack.py @@ -401,7 +401,7 @@ def test_removeContainer(global_stack): with pytest.raises(InvalidOperationError): global_stack.removeContainer(unittest.mock.MagicMock()) -## Tests adding a definition by specifying an ID of a definition that exists. +## Tests setting definitions by specifying an ID of a definition that exists. def test_setDefinitionByIdExists(global_stack, container_registry): original_container_registry = UM.Settings.ContainerStack._containerRegistry UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of. @@ -411,13 +411,13 @@ def test_setDefinitionByIdExists(global_stack, container_registry): #Restore. UM.Settings.ContainerStack._containerRegistry = original_container_registry -## Tests adding a definition by specifying an ID of a definition that doesn't +## Tests setting definitions by specifying an ID of a definition that doesn't # exist. def test_setDefinitionByIdDoesntExist(global_stack): with pytest.raises(KeyError): global_stack.setDefinitionById("some_definition") #Container registry is empty now. -## Tests adding definition changes by specifying an ID of a container that +## Tests setting definition changes by specifying an ID of a container that # exists. def test_setDefinitionChangesByIdExists(global_stack, container_registry): original_container_registry = UM.Settings.ContainerStack._containerRegistry @@ -428,12 +428,28 @@ def test_setDefinitionChangesByIdExists(global_stack, container_registry): #Restore. UM.Settings.ContainerStack._containerRegistry = original_container_registry -## Tests adding definition changes by specifying an ID of a container that +## Tests setting definition changes by specifying an ID of a container that # doesn't exist. def test_setDefinitionChangesByIdDoesntExist(global_stack): with pytest.raises(KeyError): global_stack.setDefinitionChangesById("some_definition_changes") #Container registry is empty now. +## Tests setting materials by specifying an ID of a material that exists. +def test_setMaterialByIdExists(global_stack, container_registry): + original_container_registry = UM.Settings.ContainerStack._containerRegistry + UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of. + + global_stack.setMaterialById("some_material") #The container registry always has a container with the ID. + + #Restore. + UM.Settings.ContainerStack._containerRegistry = original_container_registry + +## Tests setting materials by specifying an ID of a material that doesn't +# exist. +def test_setMaterialByIdDoesntExist(global_stack): + with pytest.raises(KeyError): + global_stack.setMaterialById("some_material") #Container registry is empty now. + ## Tests whether changing the next stack is properly forbidden. def test_setNextStack(global_stack): with pytest.raises(InvalidOperationError): @@ -480,7 +496,7 @@ def test_setPropertyOtherContainers(target_container, global_stack): } assert containers[target_container].getProperty(key, property) == output_value -## Tests adding a variant by specifying an ID of a variant that exists. +## Tests setting variants by specifying an ID of a variant that exists. def test_setVariantByIdExists(global_stack, container_registry): original_container_registry = UM.Settings.ContainerStack._containerRegistry UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of. @@ -490,7 +506,7 @@ def test_setVariantByIdExists(global_stack, container_registry): #Restore. UM.Settings.ContainerStack._containerRegistry = original_container_registry -## Tests adding a variant by specifying an ID of a variant that doesn't exist. +## Tests setting variants by specifying an ID of a variant that doesn't exist. def test_setVariantByIdDoesntExist(global_stack): with pytest.raises(KeyError): global_stack.setVariantById("some_variant") #Container registry is empty now. \ No newline at end of file