mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 14:29:03 +08:00
Add tests for setQualityById
One for when the ID exists, one for when it doesn't exist. Contributes to issue CURA-3497.
This commit is contained in:
parent
d9ba848dc8
commit
498956a190
@ -496,6 +496,21 @@ def test_setPropertyOtherContainers(target_container, global_stack):
|
|||||||
}
|
}
|
||||||
assert containers[target_container].getProperty(key, property) == output_value
|
assert containers[target_container].getProperty(key, property) == output_value
|
||||||
|
|
||||||
|
## Tests setting qualities by specifying an ID of a quality that exists.
|
||||||
|
def test_setQualityByIdExists(global_stack, container_registry):
|
||||||
|
original_container_registry = UM.Settings.ContainerStack._containerRegistry
|
||||||
|
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of.
|
||||||
|
|
||||||
|
global_stack.setQualityById("some_quality") #The container registry always has a container with the ID.
|
||||||
|
|
||||||
|
#Restore.
|
||||||
|
UM.Settings.ContainerStack._containerRegistry = original_container_registry
|
||||||
|
|
||||||
|
## Tests setting qualities by specifying an ID of a quality that doesn't exist.
|
||||||
|
def test_setQualityByIdDoesntExist(global_stack):
|
||||||
|
with pytest.raises(KeyError):
|
||||||
|
global_stack.setQualityById("some_quality") #Container registry is empty now.
|
||||||
|
|
||||||
## Tests setting variants by specifying an ID of a variant that exists.
|
## Tests setting variants by specifying an ID of a variant that exists.
|
||||||
def test_setVariantByIdExists(global_stack, container_registry):
|
def test_setVariantByIdExists(global_stack, container_registry):
|
||||||
original_container_registry = UM.Settings.ContainerStack._containerRegistry
|
original_container_registry = UM.Settings.ContainerStack._containerRegistry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user