aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-18 16:36:11 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-18 16:36:11 +0100
commit5aef54c8086ea2d51407ace02ccd9b35cd69cb09 (patch)
treea89232551f0f66d21f2462b47089d061cd36e86c /test
parentee0a4a935a95a9472655f85a04e1323f3d328898 (diff)
downloadbrowser-extension-5aef54c8086ea2d51407ace02ccd9b35cd69cb09.tar.gz
browser-extension-5aef54c8086ea2d51407ace02ccd9b35cd69cb09.zip
make "uuid" an optional property
Diffstat (limited to 'test')
-rw-r--r--test/haketilo_test/unit/test_item_preview.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/test/haketilo_test/unit/test_item_preview.py b/test/haketilo_test/unit/test_item_preview.py
index fe9a98e..5faa598 100644
--- a/test/haketilo_test/unit/test_item_preview.py
+++ b/test/haketilo_test/unit/test_item_preview.py
@@ -37,6 +37,7 @@ def test_resource_preview(driver, execute_in_page):
execute_in_page(load_script('html/item_preview.js'))
sample_resource = make_sample_resource()
+ uuid = sample_resource['uuid']
preview_div = execute_in_page(
'''
@@ -48,16 +49,18 @@ def test_resource_preview(driver, execute_in_page):
text = preview_div.text
assert '...' not in text
+ assert 'not set' not in text
for string in [
*filter(lambda v: type(v) is str, sample_resource.values()),
*[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)
+ item_version_string(sample_resource, True), uuid
]:
assert string in text
+ del sample_resource['uuid']
sample_resource['identifier'] = 'hellopear'
sample_resource['long_name'] = 'Hello Pear'
sample_resource['description'] = 'greets a pear'
@@ -73,12 +76,13 @@ def test_resource_preview(driver, execute_in_page):
sample_resource)
text = preview_div.text
- for string in ['...', 'pple', 'hello-message', 'report.spdx',
+ for string in [uuid, '...', 'pple', 'hello-message', 'report.spdx',
'LICENSES/CC0-1.0.txt', 'hello.js', 'bye.js']:
assert string not in text
for string in ['hellopear', 'Hello Pear', 'hello-msg', 'greets a pear',
- 'report_spdx', 'LICENSES/CC0-1_0_txt', 'hello_js', 'bye_js']:
+ 'report_spdx', 'LICENSES/CC0-1_0_txt', 'hello_js', 'bye_js',
+ 'not set']:
assert string in text
@pytest.mark.ext_data({
@@ -93,6 +97,7 @@ def test_mapping_preview(driver, execute_in_page):
execute_in_page(load_script('html/item_preview.js'))
sample_mapping = make_sample_mapping()
+ uuid = sample_mapping['uuid']
preview_div = execute_in_page(
'''
@@ -104,15 +109,17 @@ def test_mapping_preview(driver, execute_in_page):
text = preview_div.text
assert '...' not in text
+ assert 'not set' not in text
for string in [
*filter(lambda v: type(v) is str, sample_mapping.values()),
*[p['identifier'] for p in sample_mapping['payloads'].values()],
*[c['file'] for c in sample_mapping['source_copyright']],
- item_version_string(sample_mapping)
+ item_version_string(sample_mapping), uuid
]:
assert string in text
+ del sample_mapping['uuid']
sample_mapping['identifier'] = 'example-org-bloated'
sample_mapping['long_name'] = 'Example.org Bloated',
sample_mapping['payloads'] = dict(
@@ -129,12 +136,12 @@ def test_mapping_preview(driver, execute_in_page):
sample_mapping)
text = preview_div.text
- for string in ['...', 'inimal', 'example.org', 'report.spdx',
+ for string in [uuid, '...', 'inimal', 'example.org', 'report.spdx',
'LICENSES/CC0-1.0.txt']:
assert string not in text
for string in ['example-org-bloated', 'Example.org Bloated', 'example.com',
- 'report_spdx', 'LICENSES/CC0-1_0_txt']:
+ 'report_spdx', 'LICENSES/CC0-1_0_txt', 'not set']:
assert string in text
@pytest.mark.ext_data({