mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 03:07:53 -06:00
Add test for when setting_version doesn't match its definition
Contributes to issue CURA-3427.
This commit is contained in:
parent
2888189f57
commit
a2b0b1076a
1 changed files with 15 additions and 0 deletions
|
@ -94,6 +94,21 @@ def test_addContainerNoSettingVersion(container_registry):
|
||||||
|
|
||||||
mock_super_add_container.assert_not_called() #Should not get passed on to UM.Settings.ContainerRegistry.addContainer, because the setting_version is interpreted as 0!
|
mock_super_add_container.assert_not_called() #Should not get passed on to UM.Settings.ContainerRegistry.addContainer, because the setting_version is interpreted as 0!
|
||||||
|
|
||||||
|
def test_addContainerBadSettingVersion(container_registry):
|
||||||
|
definition = DefinitionContainer(container_id = "Test Definition")
|
||||||
|
definition.getMetaData()["setting_version"] = 3
|
||||||
|
container_registry.addContainer(definition)
|
||||||
|
|
||||||
|
instance = UM.Settings.InstanceContainer.InstanceContainer(container_id = "Test Instance")
|
||||||
|
instance.addMetaDataEntry("setting_version", 9001) #Wrong version!
|
||||||
|
instance.setDefinition(definition)
|
||||||
|
|
||||||
|
mock_super_add_container = unittest.mock.MagicMock() #Take the role of the Uranium-ContainerRegistry where the resulting container should not get registered.
|
||||||
|
with unittest.mock.patch("UM.Settings.ContainerRegistry.ContainerRegistry.addContainer", mock_super_add_container):
|
||||||
|
container_registry.addContainer(instance)
|
||||||
|
|
||||||
|
mock_super_add_container.assert_not_called() #Should not get passed on to UM.Settings.ContainerRegistry.addContainer, because the setting_version doesn't match its definition!
|
||||||
|
|
||||||
## Tests whether loading gives objects of the correct type.
|
## Tests whether loading gives objects of the correct type.
|
||||||
@pytest.mark.parametrize("filename, output_class", [
|
@pytest.mark.parametrize("filename, output_class", [
|
||||||
("ExtruderLegacy.stack.cfg", ExtruderStack),
|
("ExtruderLegacy.stack.cfg", ExtruderStack),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue