From 2c9e115488a1b3ae6cc5658dd09612c22dc2c0ed Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 11 Apr 2017 17:16:12 +0200 Subject: [PATCH] Add test for hasUserValue returning false When a value is not in user changes or in quality changes, it is no longer a user value so it shouldn't get marked as one. Contributes to issue CURA-3497. --- tests/Settings/TestGlobalStack.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/Settings/TestGlobalStack.py b/tests/Settings/TestGlobalStack.py index 00b85a38c9..bac69cee9f 100644 --- a/tests/Settings/TestGlobalStack.py +++ b/tests/Settings/TestGlobalStack.py @@ -473,6 +473,16 @@ def test_hasUserValueQualityChanges(global_stack): assert not global_stack.hasUserValue("infill_sparse_density") assert not global_stack.hasUserValue("") +## Tests whether a container in some other place on the stack is correctly not +# recognised as user value. +def test_hasNoUserValue(global_stack): + container = unittest.mock.MagicMock() + container.getMetaDataEntry = unittest.mock.MagicMock(return_value = "quality") + container.hasProperty = lambda key, property: key == "layer_height" #Only have the layer_height property set. + global_stack.quality = container + + assert not global_stack.hasUserValue("layer_height") #However this container is quality, so it's not a user value. + ## Tests whether inserting a container is properly forbidden. def test_insertContainer(global_stack): with pytest.raises(InvalidOperationError):