diff options
author | Jaime van Kessel <nallath@gmail.com> | 2019-09-06 18:26:28 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2019-09-06 18:26:28 +0300 |
commit | 6f92537305e60360643f3dee42194f59d0292029 (patch) | |
tree | 832f39fa300edf87f0ef2c277154a933ff74aeaa /plugins/XmlMaterialProfile | |
parent | 09025edffab2f382e7a7587955f1b6d5fcd25550 (diff) |
Add unhappy test for serializing nonbase material
Diffstat (limited to 'plugins/XmlMaterialProfile')
-rw-r--r-- | plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py b/plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py index 9658328c8a..e794117946 100644 --- a/plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py @@ -62,4 +62,19 @@ def test_setDirty(): material_1.setDirty(False) assert not material_1.isDirty() - assert material_2.isDirty()
\ No newline at end of file + assert material_2.isDirty() + + +def test_serializeNonBaseMaterial(): + material_1 = createXmlMaterialProfile("herpderp") + material_1.getMetaData()["base_file"] = "omgzomg" + + container_registry = MagicMock() + container_registry.isReadOnly = MagicMock(return_value=False) + container_registry.findContainers = MagicMock(return_value=[material_1]) + + with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value=container_registry)): + with pytest.raises(NotImplementedError): + # This material is not a base material, so it can't be serialized! + material_1.serialize() +
\ No newline at end of file |