Skip to content

Commit

Permalink
(#5) testing pilot/*.json filenames match definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed Mar 4, 2023
1 parent e19c26c commit 0d4e353
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def valid_conversion(value: str, func, count: int) -> bool:
def test_entity(json_filename: str):
with open(json_filename) as json_file:
entity = json.load(json_file)
filename_ext = os.path.basename(json_filename)
filename = os.path.splitext(filename_ext)[0]
assert filename == entity["Entity"], f"{entity['Entity']} defined in {filename_ext}"
jsonschema.validate(entity, schema=entity_schema)
# TODO: test choiceTypes are defined in either mrvn/*.xml or pilot/*/choiceTypes/*.json
# TODO: verify any choiceType selections are valid
Expand All @@ -69,8 +72,10 @@ def test_entity(json_filename: str):
def test_choiceType(json_filename: str):
with open(json_filename) as json_file:
choiceType = json.load(json_file)
filename_ext = os.path.basename(json_filename)
filename = os.path.splitext(filename_ext)[0]
assert filename == choiceType["Name"], f"{choiceType['Name']} defined in {filename_ext}"
jsonschema.validate(choiceType, schema=choiceType_schema)
# TODO: enforce filename matches


blocks = json.load(open("blocks.json"))
Expand Down

0 comments on commit 0d4e353

Please sign in to comment.