summaryrefslogtreecommitdiff
path: root/test/unit/test_repo_query.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-16 00:55:04 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-16 10:12:51 +0100
commit72553a2d8b5fa094a5edd5e6ec15b5125a052016 (patch)
treecfbca085fd54ce482561e65726f825c00b2ac795 /test/unit/test_repo_query.py
parentb47de554fb01b478b09d9d65b5eac4b05fd903fc (diff)
downloadbrowser-extension-72553a2d8b5fa094a5edd5e6ec15b5125a052016.tar.gz
browser-extension-72553a2d8b5fa094a5edd5e6ec15b5125a052016.zip
assume and use "$schema" properties in item definitions
Diffstat (limited to 'test/unit/test_repo_query.py')
-rw-r--r--test/unit/test_repo_query.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/test/unit/test_repo_query.py b/test/unit/test_repo_query.py
index 77c5e75..c8c4875 100644
--- a/test/unit/test_repo_query.py
+++ b/test/unit/test_repo_query.py
@@ -137,7 +137,7 @@ def test_repo_query_normal_usage(driver, execute_in_page):
'HTTP_code',
'invalid_JSON',
'newer_API_version',
- 'invalid_API_version',
+ 'invalid_response_format',
'querying_repo',
'no_results'
])
@@ -183,7 +183,7 @@ def test_repo_query_messages(driver, execute_in_page, message):
)
show_and_wait_for_repo_entry()
- elem = execute_in_page('returnval(view.repo_entries[0].info_span);')
+ elem = execute_in_page('returnval(view.repo_entries[0].info_div);')
done = has_msg('Failure to communicate with repository :(', elem)
WebDriverWait(driver, 10).until(done)
elif message == 'HTTP_code':
@@ -195,7 +195,7 @@ def test_repo_query_messages(driver, execute_in_page, message):
''')
show_and_wait_for_repo_entry()
- elem = execute_in_page('returnval(view.repo_entries[0].info_span);')
+ elem = execute_in_page('returnval(view.repo_entries[0].info_div);')
done = has_msg('Repository sent HTTP code 405 :(', elem)
WebDriverWait(driver, 10).until(done)
elif message == 'invalid_JSON':
@@ -207,7 +207,7 @@ def test_repo_query_messages(driver, execute_in_page, message):
''')
show_and_wait_for_repo_entry()
- elem = execute_in_page('returnval(view.repo_entries[0].info_span);')
+ elem = execute_in_page('returnval(view.repo_entries[0].info_div);')
done = has_msg("Repository's response is not valid JSON :(", elem)
WebDriverWait(driver, 10).until(done)
elif message == 'newer_API_version':
@@ -217,30 +217,31 @@ def test_repo_query_messages(driver, execute_in_page, message):
const response = {
ok: true,
status: 200,
- json: {api_schema_version: [1234]}
+ json: {$schema: "https://hydrilla.koszko.org/schemas/api_query_result-3.2.1.schema.json"}
};
browser.tabs.sendMessage = () => Promise.resolve(response);
''')
show_and_wait_for_repo_entry()
- elem = execute_in_page('returnval(view.repo_entries[0].info_span);')
- msg = 'Results were served using unsupported Hydrilla API version (1234). You might need to update Haketilo.'
+ elem = execute_in_page('returnval(view.repo_entries[0].info_div);')
+ msg = 'Results were served using unsupported Hydrilla API version. You might need to update Haketilo.'
WebDriverWait(driver, 10).until(has_msg(msg, elem))
- elif message == 'invalid_API_version':
+ elif message == 'invalid_response_format':
setup_view(execute_in_page, repo_urls)
execute_in_page(
'''
const response = {
ok: true,
status: 200,
- json: {api_schema_version: null}
+ /* $schema is not a string as it should be. */
+ json: {$schema: null}
};
browser.tabs.sendMessage = () => Promise.resolve(response);
''')
show_and_wait_for_repo_entry()
- elem = execute_in_page('returnval(view.repo_entries[0].info_span);')
- msg = 'Results were served using unsupported Hydrilla API version. You might need to update Haketilo.'
+ elem = execute_in_page('returnval(view.repo_entries[0].info_div);')
+ msg = 'Results were served using a nonconforming response format.'
WebDriverWait(driver, 10).until(has_msg(msg, elem))
elif message == 'querying_repo':
setup_view(execute_in_page, repo_urls)
@@ -249,7 +250,7 @@ def test_repo_query_messages(driver, execute_in_page, message):
)
show_and_wait_for_repo_entry()
- elem = execute_in_page('returnval(view.repo_entries[0].info_span);')
+ elem = execute_in_page('returnval(view.repo_entries[0].info_div);')
assert has_msg('Querying repository...', elem)(0)
elif message == 'no_results':
setup_view(execute_in_page, repo_urls)
@@ -259,8 +260,7 @@ def test_repo_query_messages(driver, execute_in_page, message):
ok: true,
status: 200,
json: {
- api_schema_version: [1],
- api_schema_revision: 1,
+ $schema: "https://hydrilla.koszko.org/schemas/api_query_result-1.schema.json",
mappings: []
}
};
@@ -268,7 +268,7 @@ def test_repo_query_messages(driver, execute_in_page, message):
''')
show_and_wait_for_repo_entry()
- elem = execute_in_page('returnval(view.repo_entries[0].info_span);')
+ elem = execute_in_page('returnval(view.repo_entries[0].info_div);')
WebDriverWait(driver, 10).until(has_msg('No results :(', elem))
else:
raise Exception('made a typo in test function params?')