mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 03:07:53 -06:00
Add tests for setDefinitionById
One for when the ID exists, and one for when it doesn't. Contributes to issue CURA-3497.
This commit is contained in:
parent
78e78ac147
commit
e4952ac8c5
1 changed files with 17 additions and 1 deletions
|
@ -274,4 +274,20 @@ def test_insertContainer(extruder_stack):
|
|||
## Tests whether removing a container is properly forbidden.
|
||||
def test_removeContainer(extruder_stack):
|
||||
with pytest.raises(InvalidOperationError):
|
||||
extruder_stack.removeContainer(unittest.mock.MagicMock())
|
||||
extruder_stack.removeContainer(unittest.mock.MagicMock())
|
||||
|
||||
## Tests setting definitions by specifying an ID of a definition that exists.
|
||||
def test_setDefinitionByIdExists(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.setDefinitionById("some_definition") #The container registry always has a container with the ID.
|
||||
|
||||
#Restore.
|
||||
UM.Settings.ContainerStack._containerRegistry = original_container_registry
|
||||
|
||||
## Tests setting definitions by specifying an ID of a definition that doesn't
|
||||
# exist.
|
||||
def test_setDefinitionByIdDoesntExist(extruder_stack):
|
||||
with pytest.raises(KeyError):
|
||||
extruder_stack.setDefinitionById("some_definition") #Container registry is empty now.
|
Loading…
Add table
Add a link
Reference in a new issue