From 92fc67cfa135526cef75311c3ee1a14e248c3060 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 15 Feb 2022 13:18:59 +0100 Subject: change store names and data keys to singular --- test/unit/test_indexeddb.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'test/unit/test_indexeddb.py') diff --git a/test/unit/test_indexeddb.py b/test/unit/test_indexeddb.py index 9041116..9f31480 100644 --- a/test/unit/test_indexeddb.py +++ b/test/unit/test_indexeddb.py @@ -77,15 +77,15 @@ def test_haketilodb_item_modifications(driver, execute_in_page): database_contents = get_db_contents(execute_in_page) - assert len(database_contents['files']) == 4 + assert len(database_contents['file']) == 4 assert all([sample_files_by_sha256[file['sha256']] == file['contents'] - for file in database_contents['files']]) - assert all([len(file) == 2 for file in database_contents['files']]) + for file in database_contents['file']]) + assert all([len(file) == 2 for file in database_contents['file']]) assert len(database_contents['file_uses']) == 4 assert all([uses['uses'] == 1 for uses in database_contents['file_uses']]) assert set([uses['sha256'] for uses in database_contents['file_uses']]) \ - == set([file['sha256'] for file in database_contents['files']]) + == set([file['sha256'] for file in database_contents['file']]) assert database_contents['mapping'] == [] assert database_contents['resource'] == [sample_item] @@ -147,7 +147,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page): for file, nr in zip(sample_files_list, uses_list)]) files = dict([(file['sha256'], file['contents']) - for file in database_contents['files']]) + for file in database_contents['file']]) assert files == dict([(file['sha256'], file['contents']) for file in sample_files_list]) @@ -179,7 +179,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page): assert uses == dict([(file['sha256'], 1) for file in sample_files_list]) files = dict([(file['sha256'], file['contents']) - for file in results[0]['files']]) + for file in results[0]['file']]) assert files == dict([(file['sha256'], file['contents']) for file in sample_files_list]) @@ -192,7 +192,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page): sample_resource = make_sample_resource() sample_mapping = make_sample_mapping() initial_data = { - 'resources': { + 'resource': { 'helloapple': { '1.12': sample_resource, '0.9': 'something_that_should_get_ignored', @@ -201,7 +201,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page): '1.11.1': 'something_that_should_get_ignored', } }, - 'mappings': { + 'mapping': { 'helloapple': { '0.1.1': sample_mapping } @@ -222,7 +222,7 @@ def test_haketilodb_item_modifications(driver, execute_in_page): def test_haketilodb_settings(driver, execute_in_page): """ indexeddb.js facilitates operating on Haketilo's internal database. - Verify assigning/retrieving values of simple "settings" item works properly. + Verify assigning/retrieving values of simple "setting" item works properly. """ execute_in_page(load_script('common/indexeddb.js')) mock_broadcast(execute_in_page) @@ -230,7 +230,7 @@ def test_haketilodb_settings(driver, execute_in_page): # Start with no database. clear_indexeddb(execute_in_page) - assert get_db_contents(execute_in_page)['settings'] == [] + assert get_db_contents(execute_in_page)['setting'] == [] assert execute_in_page('returnval(get_setting("option15"));') == None @@ -280,7 +280,7 @@ def test_haketilodb_repos(driver, execute_in_page): # Start with no database. clear_indexeddb(execute_in_page) - assert get_db_contents(execute_in_page)['repos'] == [] + assert get_db_contents(execute_in_page)['repo'] == [] sample_urls = ['https://hdrlla.example.com/', 'https://hdrlla.example.org'] @@ -342,12 +342,12 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text): sample_resource = make_sample_resource() sample_mapping = make_sample_mapping() initial_data = { - 'resources': { + 'resource': { 'helloapple': { '1.0': sample_resource } }, - 'mappings': { + 'mapping': { 'helloapple': { '0.1.1': sample_mapping } @@ -404,8 +404,8 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text): for elem_id, json_value in [ ('resource_helloapple', sample_resource), ('mapping_helloapple', sample_mapping), - ('settings_option15', {'name': 'option15', 'value': '123'}), - ('repos_https://hydril.la', {'url': 'https://hydril.la'}), + ('setting_option15', {'name': 'option15', 'value': '123'}), + ('repo_https://hydril.la', {'url': 'https://hydril.la'}), ('blocking_file:///*', {'pattern': 'file:///*', 'allow': False}) ]: assert json.loads(driver.find_element_by_id(elem_id).text) == json_value @@ -417,12 +417,12 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text): sample_mapping2 = make_sample_mapping() sample_mapping2['identifier'] = 'helloapple-copy' sample_data = { - 'resources': { + 'resource': { 'helloapple-copy': { '1.0': sample_resource2 } }, - 'mappings': { + 'mapping': { 'helloapple-copy': { '0.1.1': sample_mapping2 } @@ -441,8 +441,8 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text): for elem_id, json_value in [ ('resource_helloapple-copy', sample_resource2), ('mapping_helloapple-copy', sample_mapping2), - ('settings_option22', {'name': 'option22', 'value': 'abc'}), - ('repos_https://hydril2.la', {'url': 'https://hydril2.la'}), + ('setting_option22', {'name': 'option22', 'value': 'abc'}), + ('repo_https://hydril2.la', {'url': 'https://hydril2.la'}), ('blocking_ftp://a.bc/', {'pattern': 'ftp://a.bc/', 'allow': True}) ]: assert json.loads(driver.find_element_by_id(elem_id).text) == json_value @@ -468,7 +468,7 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text): }''') removed_ids = ['mapping_helloapple-copy', 'resource_helloapple', - 'repos_https://hydril.la', 'blocking_file:///*'] + 'repo_https://hydril.la', 'blocking_file:///*'] def condition_items_absent_and_changed(driver): for id in removed_ids: try: @@ -477,7 +477,7 @@ def test_haketilodb_track(driver, execute_in_page, wait_elem_text): except WebDriverException: pass - option_text = driver.find_element_by_id('settings_option22').text + option_text = driver.find_element_by_id('setting_option22').text blocking_text = driver.find_element_by_id('blocking_ftp://a.bc/').text return (json.loads(option_text)['value'] == None and json.loads(blocking_text)['allow'] == False) -- cgit v1.2.3