mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 06:03:57 -06:00
Add tests for setDefinitionChangesById
One for when the ID exists, one for when it doesn't exist. Contributes to issue CURA-3497.
This commit is contained in:
parent
928181507d
commit
dbc4a90e10
1 changed files with 17 additions and 0 deletions
|
@ -422,6 +422,23 @@ def test_setNextStack(global_stack):
|
||||||
with pytest.raises(InvalidOperationError):
|
with pytest.raises(InvalidOperationError):
|
||||||
global_stack.setNextStack(unittest.mock.MagicMock())
|
global_stack.setNextStack(unittest.mock.MagicMock())
|
||||||
|
|
||||||
|
## Tests adding 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
|
||||||
|
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of.
|
||||||
|
|
||||||
|
global_stack.setDefinitionChangesById("some_definition_changes") #The container registry always has a container with the ID.
|
||||||
|
|
||||||
|
#Restore.
|
||||||
|
UM.Settings.ContainerStack._containerRegistry = original_container_registry
|
||||||
|
|
||||||
|
## Tests adding 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 properties directly on the global stack.
|
## Tests setting properties directly on the global stack.
|
||||||
@pytest.mark.parametrize("key, property, value, output_value", [
|
@pytest.mark.parametrize("key, property, value, output_value", [
|
||||||
("layer_height", "value", "0.1337", 0.1337),
|
("layer_height", "value", "0.1337", 0.1337),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue