示例#1
0
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"
示例#2
0
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"
示例#3
0
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
示例#4
0
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"