Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ChEMBL
C
ChEMBL
Main Web Interface
Elasticsearch Proxy API
Commits
e7478ca5
Commit
e7478ca5
authored
Oct 01, 2021
by
David Mendez
Browse files
Add 2 functional tests for eubopen
parent
3e987a0f
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
2 deletions
+63
-2
functional_tests/run_functional_tests.py
functional_tests/run_functional_tests.py
+3
-2
functional_tests/specific_tests/eubopen/__init__.py
functional_tests/specific_tests/eubopen/__init__.py
+0
-0
functional_tests/specific_tests/eubopen/fun_test_eubopen_autocomplete.py
...s/specific_tests/eubopen/fun_test_eubopen_autocomplete.py
+23
-0
functional_tests/specific_tests/eubopen/fun_test_eubopen_search.py
...l_tests/specific_tests/eubopen/fun_test_eubopen_search.py
+22
-0
functional_tests/specific_tests/utils.py
functional_tests/specific_tests/utils.py
+15
-0
No files found.
functional_tests/run_functional_tests.py
View file @
e7478ca5
...
...
@@ -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/specific_tests/eubopen/__init__.py
0 → 100644
View file @
e7478ca5
functional_tests/specific_tests/eubopen/fun_test_eubopen_autocomplete.py
0 → 100644
View file @
e7478ca5
"""
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/specific_tests/eubopen/fun_test_eubopen_search.py
0 → 100644
View file @
e7478ca5
"""
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
)
functional_tests/specific_tests/utils.py
View file @
e7478ca5
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment