Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ChEMBL
C
ChEMBL
Main Web Interface
Elasticsearch Proxy API
Commits
44058306
Commit
44058306
authored
Jul 08, 2020
by
David Mendez
Browse files
Add functional test for registring element usage
parent
0fad1ba9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
functional_tests/run_functional_tests.py
functional_tests/run_functional_tests.py
+2
-2
functional_tests/specific_tests/fun_test_element_usage.py
functional_tests/specific_tests/fun_test_element_usage.py
+36
-0
No files found.
functional_tests/run_functional_tests.py
View file @
44058306
...
...
@@ -7,7 +7,7 @@ import argparse
from
specific_tests
import
fun_test_simple_query
,
fun_test_query_with_context
,
fun_test_property_config
,
\
fun_test_group_config
,
fun_test_facets_group_config
,
fun_test_get_document
,
fun_test_id_properties
,
\
fun_test_get_context_data
,
fun_test_search_parsing
,
fun_test_url_shortening
fun_test_get_context_data
,
fun_test_search_parsing
,
fun_test_url_shortening
,
fun_test_element_usage
PARSER
=
argparse
.
ArgumentParser
()
PARSER
.
add_argument
(
'server_base_path'
,
help
=
'server base path to run the tests against'
,
...
...
@@ -26,7 +26,7 @@ def run():
for
test_module
in
[
fun_test_simple_query
,
fun_test_query_with_context
,
fun_test_property_config
,
fun_test_group_config
,
fun_test_facets_group_config
,
fun_test_get_document
,
fun_test_id_properties
,
fun_test_get_context_data
,
fun_test_search_parsing
,
fun_test_url_shortening
]:
fun_test_url_shortening
,
fun_test_element_usage
]:
test_module
.
run_test
(
ARGS
.
server_base_path
,
ARGS
.
delayed_jobs_server_base_path
)
...
...
functional_tests/specific_tests/fun_test_element_usage.py
0 → 100644
View file @
44058306
# pylint: disable=import-error
"""
Module that tests the element usage endpoint
"""
import
requests
from
specific_tests
import
utils
def
run_test
(
server_base_url
,
delayed_jobs_server_base_path
):
"""
Tests an the element usage query to elasticsearch
: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
(
'-------------------------------------------'
)
print
(
'Testing the element usage endpoint'
)
print
(
'-------------------------------------------'
)
print
(
'delayed_jobs_server_base_path: '
,
delayed_jobs_server_base_path
)
url
=
f
'
{
server_base_url
}
/es_data/frontend_element_usage/register_element_usage'
payload
=
{
'view_name'
:
'Compound-CompoundNameAndClassification'
,
'view_type'
:
'CARD'
,
'entity_name'
:
'Compound''
}
request = requests.post(url, data=payload)
status_code = request.status_code
print(f'
status_code
:
{
status_code
}
')
response_text = request.text
utils.print_es_response(response_text)
assert status_code == 200, '
The
request
failed
!
'
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