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:
Ghostkeeper 2017-03-24 16:00:55 +01:00
parent 928181507d
commit dbc4a90e10
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -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),