Mock the limit_to_extruder property with an actual value

This is necessary because our code now converts this to an integer. Mocks can't be converted to an integer, so the sub-magic-mock here can't be used. We need to provide something that can be cast to an integer.
This commit is contained in:
Ghostkeeper 2020-06-02 14:01:09 +02:00
parent 825a34d418
commit 93c84d5bc0
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -24,6 +24,11 @@ def setting_override_decorator():
def test_onSettingValueChanged(setting_override_decorator):
def mock_getRawProperty(key, property_name, *args, **kwargs):
if property_name == "limit_to_extruder":
return "-1"
return MagicMock(name="rawProperty")
container_registry.findContainerStacks().__getitem__().getRawProperty = mock_getRawProperty
# On creation the needs slicing should be called once (as it being added should trigger a reslice)
assert application.getBackend().needsSlicing.call_count == 1
with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)):