Commit e7478ca5 authored by David Mendez's avatar David Mendez
Browse files

Add 2 functional tests for eubopen

parent 3e987a0f
......@@ -15,6 +15,7 @@ from specific_tests import fun_test_simple_query, fun_test_query_with_context, \
fun_test_get_all_properties, fun_test_identify_separator
from specific_tests.entities_join import fun_test_entities_join_all_tests
from functional_tests.specific_tests.eubopen import fun_test_eubopen_autocomplete, fun_test_eubopen_search
PARSER = argparse.ArgumentParser()
PARSER.add_argument('server_base_path', help='server base path to run the tests against',
......@@ -39,8 +40,8 @@ def run():
fun_test_go_slim_target_classification, fun_test_in_vivo_assay_classification,
fun_test_organism_taxonomy_target_classification, fun_test_protein_target_classification,
fun_test_covid_entities_records, fun_test_database_summary, fun_test_entities_records,
fun_test_get_all_properties, fun_test_identify_separator, fun_test_entities_join_all_tests]:
fun_test_get_all_properties, fun_test_identify_separator, fun_test_entities_join_all_tests,
fun_test_eubopen_autocomplete, fun_test_eubopen_search]:
test_module.run_test(ARGS.server_base_path, ARGS.delayed_jobs_server_base_path)
......
"""
Functional tests for the eubopen autocomplete
"""
from specific_tests import utils
def run_test(server_base_url, delayed_jobs_server_base_path):
"""
Tests doing a join among different entities selecting all ids
:param server_base_url: base url of the running server. E.g. http://127.0.0.1:5000
:param delayed_jobs_server_base_path: base path for the delayed_jobs
"""
print('Starting eubopen autocomplete tests...')
print(delayed_jobs_server_base_path)
payload = {
'term': 'Asp'
}
url = f'{server_base_url}/eubopen/search/autocomplete'
utils.assert_post_request_succeeds(url, payload)
"""
Functional tests for the eubopen search
"""
from specific_tests import utils
def run_test(server_base_url, delayed_jobs_server_base_path):
"""
Tests doing a join among different entities selecting all ids
:param server_base_url: base url of the running server. E.g. http://127.0.0.1:5000
:param delayed_jobs_server_base_path: base path for the delayed_jobs
"""
print('Starting eubopen search tests...')
print(delayed_jobs_server_base_path)
payload = {
'term': 'Asp'
}
url = f'{server_base_url}/eubopen/search/free_text'
utils.assert_post_request_succeeds(url, payload)
......@@ -89,6 +89,21 @@ def assert_get_request_succeeds(url_to_test, params=None):
assert status_code == 200, 'The request failed!'
def assert_post_request_succeeds(url_to_test, payload=None):
"""
tests that doing a get to the url returns a 200 code
:param url_to_test: url to test
:param payload: payload to include
"""
request = requests.post(url_to_test, data=payload)
status_code = request.status_code
response_text = request.text
print_es_response(response_text)
assert status_code == 200, 'The request failed!'
def submit_similarity_search_job(delayed_jobs_server_base_path):
"""
:param delayed_jobs_server_base_path: base path of the delayed jobs server
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment