From 3d6ffa57e8a901bd61c2d95fbb6d1ca16d811898 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 9 Feb 2022 18:29:49 +0100 Subject: make resource dependency specifier an object --- test/unit/test_indexeddb_files_server.py | 4 ++-- test/unit/test_item_list.py | 2 +- test/unit/test_item_preview.py | 4 ++-- test/unit/utils.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'test/unit') diff --git a/test/unit/test_indexeddb_files_server.py b/test/unit/test_indexeddb_files_server.py index 390bbe7..d320eba 100644 --- a/test/unit/test_indexeddb_files_server.py +++ b/test/unit/test_indexeddb_files_server.py @@ -41,7 +41,7 @@ def make_sample_resource_with_deps(n): resource = make_sample_resource(with_files=False) resource['identifier'] = f'res-{n}' - resource['dependencies'] = [f'res-{m}' + resource['dependencies'] = [{'identifier': f'res-{m}'} for m in range(max(n - 4, 0), n)] resource['scripts'] = [sample_file_ref(f'file_{n}_{i}', sample_files) for i in range(2)] @@ -141,7 +141,7 @@ def test_indexeddb_files_server_errors(driver, execute_in_page, error): del sample_data_copy['resources']['res-3'] elif error == 'circular': res3_defs = sample_data_copy['resources']['res-3'].values() - next(iter(res3_defs))['dependencies'].append('res-8') + next(iter(res3_defs))['dependencies'].append({'identifier': 'res-8'}) prepare_test_page(sample_data_copy, execute_in_page) diff --git a/test/unit/test_item_list.py b/test/unit/test_item_list.py index 46691c3..189646e 100644 --- a/test/unit/test_item_list.py +++ b/test/unit/test_item_list.py @@ -38,7 +38,7 @@ def make_sample_resource(identifier, long_name): 'version': [2021, 11, 10], 'revision': 1, 'description': 'greets an apple', - 'dependencies': ['hello-message'], + 'dependencies': [{'identifier': 'hello-message'}], 'scripts': [ sample_file_ref('hello.js'), sample_file_ref('bye.js') diff --git a/test/unit/test_item_preview.py b/test/unit/test_item_preview.py index 8787d5d..c715d75 100644 --- a/test/unit/test_item_preview.py +++ b/test/unit/test_item_preview.py @@ -51,7 +51,7 @@ def test_resource_preview(driver, execute_in_page): for string in [ *filter(lambda v: type(v) is str, sample_resource.values()), - *sample_resource['dependencies'], + *[rr['identifier'] for rr in sample_resource['dependencies']], *[c['file'] for k in ('source_copyright', 'scripts') for c in sample_resource[k]], item_version_string(sample_resource, True) @@ -61,7 +61,7 @@ def test_resource_preview(driver, execute_in_page): sample_resource['identifier'] = 'hellopear' sample_resource['long_name'] = 'Hello Pear' sample_resource['description'] = 'greets a pear' - sample_resource['dependencies'] = ['hello-msg'], + sample_resource['dependencies'] = [{'identifier': 'hello-msg'}] for key in ('scripts', 'source_copyright'): for file_ref in sample_resource[key]: file_ref['file'] = file_ref['file'].replace('.', '_') diff --git a/test/unit/utils.py b/test/unit/utils.py index 85dee63..04a4d97 100644 --- a/test/unit/utils.py +++ b/test/unit/utils.py @@ -118,7 +118,7 @@ def make_sample_resource(with_files=True): 'version': [2021, 11, 10], 'revision': 1, 'description': 'greets an apple', - 'dependencies': ['hello-message'], + 'dependencies': [{'identifier': 'hello-message'}], 'scripts': [ sample_file_ref('hello.js'), sample_file_ref('bye.js') -- cgit v1.2.3