def test_getMaterialNode(application): with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)): manager = MaterialManager(mocked_registry) manager._updateMaps() assert manager.getMaterialNode("fdmmachine", None, None, 3, "base_material").container_id == "test"
def test_getMaterialNode(application): with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)): manager = MaterialManager(mocked_registry) manager.initialize() assert manager.getMaterialNode( "fdmmachine", None, None, 3, "base_material").getMetaDataEntry("id") == "test"
def test_getMaterialNodeByTypeMachineHasMaterialsAndMaterialExists(application): with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)): manager = MaterialManager(mocked_registry) manager.initialize() mocked_result = MagicMock() manager.getMaterialNode = MagicMock(return_value = mocked_result) mocked_stack = MagicMock() mocked_stack.definition.getMetaDataEntry = MagicMock(return_value = True) # For the "has_materials" metadata assert manager.getMaterialNodeByType(mocked_stack, "0", "nozzle", "", "TEST!") is mocked_result
def test_getMaterialNode(application): with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)): manager = MaterialManager(mocked_registry) manager.initialize() assert manager.getMaterialNode("fdmmachine", None, None, 3, "base_material").getMetaDataEntry("id") == "test"