Add test for detecting quality changes

I should try to re-use a bit of code here because there's going to be a lot of these.

Contributes to issue CURA-3497.
This commit is contained in:
Ghostkeeper 2017-03-22 16:58:06 +01:00
parent 2eed596280
commit 09a3b90dcc
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75
2 changed files with 32 additions and 2 deletions

View file

@ -43,10 +43,32 @@ def test_deserializeUserChanges(filename, user_changes_id, container_registry):
serialized = file_handle.read()
stack = cura.Settings.GlobalStack.GlobalStack("TestStack")
#Mock the loading of the instances.
#Mock the loading of the instance containers.
stack.findContainer = findSomeContainers
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all profiles you ask of.
stack.deserialize(serialized)
assert stack.userChanges.getId() == user_changes_id
assert stack.userChanges.getId() == user_changes_id
## Tests whether the quality changes are being read properly from a global
# stack.
@pytest.mark.parametrize("filename, quality_changes_id", [
("Global.global.cfg", "empty"),
("Global.stack.cfg", "empty"),
("MachineLegacy.stack.cfg", "empty"),
("OnlyQualityChanges.global.cfg", "some_instance"),
("Complete.global.cfg", "some_quality_changes")
])
def test_deserializeQualityChanges(filename, quality_changes_id, container_registry):
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "stacks", filename)) as file_handle:
serialized = file_handle.read()
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.qualityChanges.getId() == quality_changes_id