aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_indexeddb.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/test_indexeddb.py')
-rw-r--r--test/unit/test_indexeddb.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/test/unit/test_indexeddb.py b/test/unit/test_indexeddb.py
index 07b620c..aea633b 100644
--- a/test/unit/test_indexeddb.py
+++ b/test/unit/test_indexeddb.py
@@ -78,7 +78,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page):
execute_in_page(
'''{
- const promise = start_items_transaction(["resources"], arguments[1])
+ const promise = start_items_transaction(["resource"], arguments[1])
.then(ctx => save_item(arguments[0], ctx).then(() => ctx))
.then(finalize_transaction);
returnval(promise);
@@ -97,8 +97,8 @@ def test_haketilodb_item_modifications(driver, execute_in_page):
assert set([uses['hash_key'] for uses in database_contents['file_uses']]) \
== set([file['hash_key'] for file in database_contents['files']])
- assert database_contents['mappings'] == []
- assert database_contents['resources'] == [sample_item]
+ assert database_contents['mapping'] == []
+ assert database_contents['resource'] == [sample_item]
# See if trying to add an item without providing all its files ends in an
# exception and aborts the transaction as it should.
@@ -111,7 +111,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page):
async function try_add_item()
{
const context =
- await start_items_transaction(["resources"], args[1]);
+ await start_items_transaction(["resource"], args[1]);
try {
await save_item(args[0], context);
await finalize_transaction(context);
@@ -137,7 +137,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page):
sample_item = make_sample_mapping()
database_contents = execute_in_page(
'''{
- const promise = start_items_transaction(["mappings"], arguments[1])
+ const promise = start_items_transaction(["mapping"], arguments[1])
.then(ctx => save_item(arguments[0], ctx).then(() => ctx))
.then(finalize_transaction);
returnval(promise);
@@ -161,9 +161,9 @@ def test_haketilodb_item_modifications(driver, execute_in_page):
assert files == dict([(file['hash_key'], file['contents'])
for file in sample_files_list])
- del database_contents['resources'][0]['source_copyright'][0]['extra_prop']
- assert database_contents['resources'] == [make_sample_resource()]
- assert database_contents['mappings'] == [sample_item]
+ del database_contents['resource'][0]['source_copyright'][0]['extra_prop']
+ assert database_contents['resource'] == [make_sample_resource()]
+ assert database_contents['mapping'] == [sample_item]
# Try removing the items to get an empty database again.
results = [None, None]
@@ -172,7 +172,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page):
f'''{{
const remover = remove_{item_type};
const promise =
- start_items_transaction(["{item_type}s"], {{}})
+ start_items_transaction(["{item_type}"], {{}})
.then(ctx => remover('helloapple', ctx).then(() => ctx))
.then(finalize_transaction);
returnval(promise);
@@ -193,8 +193,8 @@ def test_haketilodb_item_modifications(driver, execute_in_page):
assert files == dict([(file['hash_key'], file['contents'])
for file in sample_files_list])
- assert results[0]['resources'] == []
- assert results[0]['mappings'] == [sample_item]
+ assert results[0]['resource'] == []
+ assert results[0]['mapping'] == [sample_item]
assert results[1] == dict([(key, []) for key in results[0].keys()])
@@ -223,8 +223,8 @@ def test_haketilodb_item_modifications(driver, execute_in_page):
execute_in_page('initial_data = arguments[0];', initial_data)
database_contents = get_db_contents(execute_in_page)
- assert database_contents['resources'] == [sample_resource]
- assert database_contents['mappings'] == [sample_mapping]
+ assert database_contents['resource'] == [sample_resource]
+ assert database_contents['mapping'] == [sample_mapping]
@pytest.mark.get_page('https://gotmyowndoma.in')
def test_haketilodb_settings(driver, execute_in_page):
@@ -407,8 +407,8 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text):
}''')
assert item_counts == [1 for _ in item_counts]
for elem_id, json_value in [
- ('resources_helloapple', sample_resource),
- ('mappings_helloapple', sample_mapping),
+ ('resource_helloapple', sample_resource),
+ ('mapping_helloapple', sample_mapping),
('settings_option15', {'name': 'option15', 'value': '123'}),
('repos_https://hydril.la', {'url': 'https://hydril.la'}),
('blocking_file:///*', {'pattern': 'file:///*', 'allow': False})
@@ -442,8 +442,8 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text):
driver.switch_to.window(windows[0])
driver.implicitly_wait(10)
for elem_id, json_value in [
- ('resources_helloapple-copy', sample_resource2),
- ('mappings_helloapple-copy', sample_mapping2),
+ ('resource_helloapple-copy', sample_resource2),
+ ('mapping_helloapple-copy', sample_mapping2),
('settings_option22', {'name': 'option22', 'value': 'abc'}),
('repos_https://hydril2.la', {'url': 'https://hydril2.la'}),
('blocking_ftp://a.bc/', {'pattern': 'ftp://a.bc/', 'allow': True})
@@ -457,7 +457,7 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text):
'''{
async function change_remove_items()
{
- const store_names = ["resources", "mappings"];
+ const store_names = ["resource", "mapping"];
const ctx = await start_items_transaction(store_names, {});
await remove_resource("helloapple", ctx);
await remove_mapping("helloapple-copy", ctx);
@@ -470,7 +470,7 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text):
returnval(change_remove_items());
}''')
- removed_ids = ['mappings_helloapple-copy', 'resources_helloapple',
+ removed_ids = ['mapping_helloapple-copy', 'resource_helloapple',
'repos_https://hydril.la', 'blocking_file:///*']
def condition_items_absent_and_changed(driver):
for id in removed_ids: