示例#1
0
    def test_wrongDiameter(self, application):
        with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)):
            manager = MaterialManager(mocked_registry)
        manager.initialize()

        available_materials = manager.getAvailableMaterials(mocked_definition, None, None, 200)
        assert available_materials == {} # Nothing found.
示例#2
0
 def test_excludedMaterials(self, application):
     with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)):
         manager = MaterialManager(mocked_registry)
     manager.initialize()
     with patch.object(mocked_definition, "getMetaDataEntry", MagicMock(return_value = ["test"])):
         available_materials = manager.getAvailableMaterials(mocked_definition, None, None, 3)
     assert "base_material" in available_materials
     assert "test" not in available_materials
示例#3
0
def test_getAvailableMaterials(application):
    with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)):
        manager = MaterialManager(mocked_registry)
    manager.initialize()

    available_materials = manager.getAvailableMaterials(mocked_definition, None, None, 3)

    assert "base_material" in available_materials
    assert "test" in available_materials
示例#4
0
    def test_happy(self, application):
        with patch("UM.Application.Application.getInstance", MagicMock(return_value=application)):
            manager = MaterialManager(mocked_registry)
        manager.initialize()

        available_materials = manager.getAvailableMaterials(mocked_definition, None, None, 3)

        assert "base_material" in available_materials
        assert "test" in available_materials