Add test to see whether quality profiles deserialise well

Works just the same as the quality-changes stuff.

Contributes to issue CURA-3497.
This commit is contained in:
Ghostkeeper 2017-03-22 17:24:21 +01:00
parent ba43b835f4
commit eae6ad0e05
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75
2 changed files with 30 additions and 1 deletions

View file

@ -79,4 +79,25 @@ def test_deserializeQualityChanges(filename, quality_changes_id, container_regis
stack.deserialize(serialized)
assert stack.qualityChanges.getId() == quality_changes_id
assert stack.qualityChanges.getId() == quality_changes_id
## Tests whether the quality profile is being read properly from a global
# stack.
@pytest.mark.parametrize("filename, quality_id", [
("Global.global.cfg", "empty"),
("Global.stack.cfg", "empty"),
("MachineLegacy.stack.cfg", "empty"),
("OnlyQuality.global.cfg", "some_instance"),
("Complete.global.cfg", "some_quality")
])
def test_deserializeQualityChanges(filename, quality_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.quality.getId() == quality_id