From 57ce414ca81682a71288018a4d9001604002ec23 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 1 Mar 2022 11:29:26 +0100 Subject: validate repository responses against JSON schemas * compute_scripts.awk (include_file): don't enforce specific path format on #INCLUDE'd files * .gitmodules, schemas: add Haketilo JSON schemas subrepo * html/install.js (InstallView): import schema validator and run it against downloaded mapping and resource definitions * html/repo_query.js (RepoEntry): import schema validator and run it against obtained query results * test/haketilo_test/unit/test_install.py (test_install_normal_usage, test_install_dialogs): use underscore instead of hyphen in item identifiers * test/haketilo_test/unit/test_install.py (test_install_dialogs): adapt error message test cases to new handling method of invalid JSON instanced * test/haketilo_test/unit/test_repo_query.py (test_repo_query_normal_usage): use underscore instead of hyphen in item identifiers * test/haketilo_test/unit/test_repo_query.py (test_repo_query_messages): use higher sample unsupported schema version to avoid having to modify the test case soon * test/haketilo_test/world_wide_library.py: use underscore instead of hyphen in item identifiers * common/jsonschema.js, common/jsonschema: adapt tdegrunt's jsonschema and include in Haketilo, load schema documents from schemas/ --- test/haketilo_test/world_wide_library.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/haketilo_test/world_wide_library.py') diff --git a/test/haketilo_test/world_wide_library.py b/test/haketilo_test/world_wide_library.py index a932821..fedfeb6 100644 --- a/test/haketilo_test/world_wide_library.py +++ b/test/haketilo_test/world_wide_library.py @@ -127,14 +127,14 @@ for deps in [(0, 1, 2, 3), (3, 4, 5, 6), (6, 7, 8, 9)]: sample_resource_templates.append({ 'id_suffix': ''.join(letters), 'files_count': deps[0], - 'dependencies': [{'identifier': f'resource_{l}'} for l in letters] + 'dependencies': [{'identifier': f'resource-{l}'} for l in letters] }) suffixes = [srt['id_suffix'] for srt in sample_resource_templates] sample_resource_templates.append({ 'id_suffix': '-'.join(suffixes), 'files_count': 2, - 'dependencies': [{'identifier': f'resource_{suf}'} for suf in suffixes] + 'dependencies': [{'identifier': f'resource-{suf}'} for suf in suffixes] }) for i in range(10): @@ -150,7 +150,7 @@ sample_queries = {} for srt in sample_resource_templates: resource = make_sample_resource() - resource['identifier'] = f'resource_{srt["id_suffix"]}' + resource['identifier'] = f'resource-{srt["id_suffix"]}' resource['long_name'] = resource['identifier'].upper() resource['uuid'] = str(uuid4()) resource['dependencies'] = srt['dependencies'] @@ -164,7 +164,7 @@ for srt in sample_resource_templates: resource_versions[1][-1] += 1 mapping = make_sample_mapping() - mapping['identifier'] = f'mapping_{srt["id_suffix"]}' + mapping['identifier'] = f'mapping-{srt["id_suffix"]}' mapping['long_name'] = mapping['identifier'].upper() mapping['uuid'] = str(uuid4()) mapping['source_copyright'] = resource['source_copyright'] -- cgit v1.2.3