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.
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
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
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