aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-09 18:29:49 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-09 18:29:49 +0100
commit3d6ffa57e8a901bd61c2d95fbb6d1ca16d811898 (patch)
tree71878aacd7dae3dab9150f3f34f8256f92c95480 /test
parent1c65dd5ca24052ccf9a92939eecd0966c9635c50 (diff)
downloadbrowser-extension-3d6ffa57e8a901bd61c2d95fbb6d1ca16d811898.tar.gz
browser-extension-3d6ffa57e8a901bd61c2d95fbb6d1ca16d811898.zip
make resource dependency specifier an object
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_indexeddb_files_server.py4
-rw-r--r--test/unit/test_item_list.py2
-rw-r--r--test/unit/test_item_preview.py4
-rw-r--r--test/unit/utils.py2
-rw-r--r--test/world_wide_library.py4
5 files changed, 8 insertions, 8 deletions
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')
diff --git a/test/world_wide_library.py b/test/world_wide_library.py
index 04f5e8b..56af35f 100644
--- a/test/world_wide_library.py
+++ b/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': [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': [f'resource_{suffix}' for suffix in suffixes]
+ 'dependencies': [{'identifier': f'resource_{suf}'} for suf in suffixes]
})
for i in range(10):