mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03:56 -06:00
Check if every quality is matched to an existing definition
This commit is contained in:
parent
98704e72a2
commit
1e280c2869
1 changed files with 13 additions and 1 deletions
|
@ -17,17 +17,29 @@ def collectAllQualities():
|
|||
return result
|
||||
|
||||
|
||||
def collecAllDefinitionIds():
|
||||
result = []
|
||||
for root, directories, filenames in os.walk(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "resources", "definitions"))):
|
||||
for filename in filenames:
|
||||
result.append(os.path.basename(filename).split(".")[0])
|
||||
return result
|
||||
|
||||
|
||||
all_definition_ids = collecAllDefinitionIds()
|
||||
quality_filepaths = collectAllQualities()
|
||||
|
||||
|
||||
## Atempt to load all the quality types
|
||||
@pytest.mark.parametrize("file_name", quality_filepaths)
|
||||
def test_validateQualityProfiles(file_name):
|
||||
try:
|
||||
with open(file_name, encoding="utf-8") as data:
|
||||
json = data.read()
|
||||
InstanceContainer._readAndValidateSerialized(json)
|
||||
result = InstanceContainer._readAndValidateSerialized(json)
|
||||
# Fairly obvious, but all the types here should be of the type quality
|
||||
assert InstanceContainer.getConfigurationTypeFromSerialized(json) == "quality"
|
||||
# All quality profiles must be linked to an existing definition.
|
||||
assert result["general"]["definition"] in all_definition_ids
|
||||
|
||||
except Exception as e:
|
||||
# File can't be read, header sections missing, whatever the case, this shouldn't happen!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue