Make cache of machines a protected field

We don't want to use it outside of the mapping. This mapping should be transparent.
We are still using it from our tests though but that's fine. Tests are allowed to touch private fields.

Contributes to issue CURA-6793.
This commit is contained in:
Ghostkeeper 2019-10-16 15:04:07 +02:00
parent 5624f0a8ae
commit 8179dfc412
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
2 changed files with 8 additions and 8 deletions

View file

@ -55,7 +55,7 @@ def test_getCurrentQualityGroupsNoGlobalStack(container_registry):
def test_getCurrentQualityGroups(container_registry, application):
with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value = container_registry)):
container_tree = ContainerTree()
container_tree.machines.machines["current_global_stack"] = MagicMock() # Mock so that we can track whether the getQualityGroups function gets called with correct parameters.
container_tree.machines._machines["current_global_stack"] = MagicMock() # Mock so that we can track whether the getQualityGroups function gets called with correct parameters.
with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value = application)):
result = container_tree.getCurrentQualityGroups()
@ -79,7 +79,7 @@ def test_getCurrentQualityChangesGroupsNoGlobalStack(container_registry):
def test_getCurrentQualityChangesGroups(container_registry, application):
with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value = container_registry)):
container_tree = ContainerTree()
container_tree.machines.machines["current_global_stack"] = MagicMock() # Mock so that we can track whether the getQualityGroups function gets called with correct parameters.
container_tree.machines._machines["current_global_stack"] = MagicMock() # Mock so that we can track whether the getQualityGroups function gets called with correct parameters.
with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value = application)):
result = container_tree.getCurrentQualityChangesGroups()