mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 05:37:50 -06:00
Add tests for setQualityById
One for when the ID exists, and one for when it doesn't. Contributes to issue CURA-3497.
This commit is contained in:
parent
eb7035db45
commit
393ee7838a
1 changed files with 16 additions and 1 deletions
|
@ -307,3 +307,18 @@ def test_setMaterialByIdExists(extruder_stack, container_registry):
|
||||||
def test_setMaterialByIdDoesntExist(extruder_stack):
|
def test_setMaterialByIdDoesntExist(extruder_stack):
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
extruder_stack.setMaterialById("some_material") #Container registry is empty now.
|
extruder_stack.setMaterialById("some_material") #Container registry is empty now.
|
||||||
|
|
||||||
|
## Tests setting qualities by specifying an ID of a quality that exists.
|
||||||
|
def test_setQualityByIdExists(extruder_stack, container_registry):
|
||||||
|
original_container_registry = UM.Settings.ContainerStack._containerRegistry
|
||||||
|
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of.
|
||||||
|
|
||||||
|
extruder_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(extruder_stack):
|
||||||
|
with pytest.raises(KeyError):
|
||||||
|
extruder_stack.setQualityById("some_quality") #Container registry is empty now.
|
Loading…
Add table
Add a link
Reference in a new issue