From ea5530c507e02c4edb97ed12416fb94ed22d4dcc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 6 Sep 2019 17:21:56 +0200 Subject: [PATCH] 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. --- tests/Machines/TestContainerTree.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/Machines/TestContainerTree.py b/tests/Machines/TestContainerTree.py index ed54774acd..c6fbccc266 100644 --- a/tests/Machines/TestContainerTree.py +++ b/tests/Machines/TestContainerTree.py @@ -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_is_enabled = [True, True] - container_tree.machines["current_global_stack"].getQualityGroups.assert_called_with(expected_variant_names, expected_material_base_files, expected_is_enabled) \ No newline at end of file + 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 \ No newline at end of file