Add test for deserializing stacks with definitions in them

This tests whether the definition is properly found.

Contributes to issue CURA-3497.
This commit is contained in:
Ghostkeeper 2017-03-23 15:40:44 +01:00
parent 91f51d11cd
commit 521e85b2a7
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -164,4 +164,24 @@ def test_deserializeDefinitionChanges(filename, definition_changes_id, container
stack.deserialize(serialized)
assert stack.variant.getId() == definition_changes_id
assert stack.variant.getId() == definition_changes_id
## Tests whether the definition is being read properly from a global stack.
@pytest.mark.parametrize("filename, definition_id", [
("Global.global.cfg", "some_definition"),
("Global.stack.cfg", "some_definition"),
("MachineLegacy.stack.cfg", "some_definition"),
("OnlyDefinition.global.cfg", "some_definition"),
("Complete.global.cfg", "some_definition")
])
def test_deserializeDefinition(filename, definition_id, container_registry):
serialized = readStack(filename)
stack = cura.Settings.GlobalStack.GlobalStack("TestStack")
#Mock the loading of the instance containers.
stack.findContainer = findSomeContainers
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of.
stack.deserialize(serialized)
assert stack.definition.getId() == definition_id