Add test for getting quality changes groups without global stack

Shouldn't crash. Instead it should give no quality changes groups.

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-09-06 17:21:56 +02:00
parent 8bcd9b339a
commit ea5530c507
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -93,4 +93,12 @@ def test_getCurrentQualityGroups(container_registry, application):
expected_material_base_files = ["current_global_stack_left_material_base_file", "current_global_stack_right_material_base_file"] expected_material_base_files = ["current_global_stack_left_material_base_file", "current_global_stack_right_material_base_file"]
expected_is_enabled = [True, True] expected_is_enabled = [True, True]
container_tree.machines["current_global_stack"].getQualityGroups.assert_called_with(expected_variant_names, expected_material_base_files, expected_is_enabled) container_tree.machines["current_global_stack"].getQualityGroups.assert_called_with(expected_variant_names, expected_material_base_files, expected_is_enabled)
def test_getCurrentQualityChangesGroupsNoGlobalStack(container_registry):
with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value = container_registry)):
with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value = MagicMock(getGlobalContainerStack = MagicMock(return_value = None)))):
container_tree = ContainerTree()
result = container_tree.getCurrentQualityChangesGroups()
assert len(result) == 0