mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03:56 -06:00
Remove _added functions for nodes that can't be added during runtime
Among the machines, variants, materials, qualities and intents, only machines and materials can ever be added during runtime. For the rest, we don't need to listen to these signals. Contributes to issue CURA-6600.
This commit is contained in:
parent
97e77994a1
commit
80baeb9873
6 changed files with 7 additions and 188 deletions
|
@ -4,14 +4,6 @@ import pytest
|
|||
from UM.Settings.Interfaces import ContainerInterface
|
||||
from cura.Machines.MachineNode import MachineNode
|
||||
|
||||
|
||||
machine_node_variant_added_test_data = [({"type": "Not a variant!"}, ["Variant One", "Variant Two"]), # Wrong type
|
||||
({"type": "variant", "name": "Variant One"}, ["Variant One", "Variant Two"]), # Name already added
|
||||
({"type": "variant", "name": "Variant Three", "hardware_type": "Not a nozzle"}, ["Variant One", "Variant Two"]), # Wrong hardware type
|
||||
({"type": "variant", "name": "Variant Three", "hardware_type": "nozzle", "definition": "machine_3"}, ["Variant One", "Variant Two"]), # Wrong definition ID
|
||||
({"type": "variant", "name": "Variant Three", "hardware_type": "nozzle", "definition": "machine_1"}, ["Variant One", "Variant Two", "Variant Three"])] # Yay! It's finally added
|
||||
|
||||
|
||||
metadata_dict = {}
|
||||
|
||||
|
||||
|
@ -44,18 +36,4 @@ def test_machineNodeInit(container_registry):
|
|||
# As variants get stored by name, we want to check if those get added.
|
||||
assert "Variant One" in machine_node.variants
|
||||
assert "Variant Two" in machine_node.variants
|
||||
assert len(machine_node.variants) == 2 # And ensure that *only* those two got added.
|
||||
|
||||
|
||||
@pytest.mark.parametrize("metadata,variant_result_list", machine_node_variant_added_test_data)
|
||||
def test_machineNodeVariantAdded(container_registry, metadata, variant_result_list):
|
||||
machine_node = createMachineNode("machine_1", container_registry)
|
||||
|
||||
with patch("cura.Machines.MachineNode.VariantNode"): # We're not testing the variant node here, so patch it out.
|
||||
with patch.dict(metadata_dict, metadata):
|
||||
mocked_container = createMockedInstanceContainer()
|
||||
machine_node._variantAdded(mocked_container)
|
||||
|
||||
assert len(variant_result_list) == len(machine_node.variants)
|
||||
for name in variant_result_list:
|
||||
assert name in machine_node.variants
|
||||
assert len(machine_node.variants) == 2 # And ensure that *only* those two got added.
|
Loading…
Add table
Add a link
Reference in a new issue