From f6a698f4750413c3618b2e0ca38ff03f1d7a7070 Mon Sep 17 00:00:00 2001 From: AlanSimmons Date: Sun, 28 Jul 2024 15:46:36 -0400 Subject: [PATCH] tests for codes/{code_id}/terms --- .../common_routes/common_neo4j_logic.py | 1 - tests/test_dd_api.sh | 27 ++++++++++++++++++ tests/test_ubkg_api.sh | 28 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/ubkg_api/common_routes/common_neo4j_logic.py b/src/ubkg_api/common_routes/common_neo4j_logic.py index 9a8f97b..52b90c6 100644 --- a/src/ubkg_api/common_routes/common_neo4j_logic.py +++ b/src/ubkg_api/common_routes/common_neo4j_logic.py @@ -1111,7 +1111,6 @@ def codes_code_id_terms_get_logic(neo4j_instance,code_id: str, term_type=None) - # Set timeout for query based on value in app.cfg. query = neo4j.Query(text=querytxt, timeout=neo4j_instance.timeout) - with neo4j_instance.driver.session() as session: recds: neo4j.Result = session.run(query) for record in recds: diff --git a/tests/test_dd_api.sh b/tests/test_dd_api.sh index b66379d..b7196ab 100755 --- a/tests/test_dd_api.sh +++ b/tests/test_dd_api.sh @@ -131,6 +131,33 @@ curl --request GET \ echo | tee -a test.out echo | tee -a test.out +#-------------------------------------------- +echo "TESTS FOR: codes//terms" | tee -a test.out +echo "SIGNATURE: /codes//terms" | tee -a test.out +echo | tee -a test.out +echo | tee -a test.out + +echo "1. codes/SNOMEDCT_US%3A254837009X/terms => no match; should return custom 404" | tee -a test.out +curl --request GET \ + --url "${UBKG_URL}/codes/SNOMEDCT_US%3A254837009X/terms" \ + --header "Authorization: UMLS-Key $umlskey" | tee -a test.out +echo | tee -a test.out +echo | tee -a test.out + +echo "2. codes/SNOMEDCT_US%3A254837009/terms?term_typex=PT => invalid parameter; should return custom 404" | tee -a test.out +curl --request GET \ + --url "${UBKG_URL}/codes/SNOMEDCT_US%3A254837009/terms?term_typex=PT" \ + --header "Authorization: UMLS-Key $umlskey" | tee -a test.out +echo | tee -a test.out +echo | tee -a test.out + +echo "3. codes/SNOMEDCT_US%3A254837009/terms?term_type=PT => valid; should return 200" | tee -a test.out +curl --request GET \ + --url "${UBKG_URL}/codes/SNOMEDCT_US%3A254837009/terms?term_type=PT" \ + --header "Authorization: UMLS-Key $umlskey" | tee -a test.out +echo | tee -a test.out +echo | tee -a test.out + #-------------------------------------------- echo "TESTS FOR: concepts//codes GET" | tee -a test.out echo "SIGNATURE: /concepts//codes"| tee -a test.out diff --git a/tests/test_ubkg_api.sh b/tests/test_ubkg_api.sh index ae6c23f..9fe05ec 100755 --- a/tests/test_ubkg_api.sh +++ b/tests/test_ubkg_api.sh @@ -117,6 +117,34 @@ curl --request GET \ echo | tee -a test.out echo | tee -a test.out +#-------------------------------------------- +echo "TESTS FOR: codes//terms" | tee -a test.out +echo "SIGNATURE: /codes//terms" | tee -a test.out +echo | tee -a test.out +echo | tee -a test.out + +echo "1. codes/SNOMEDCT_US%3A254837009X/terms => no match; should return custom 404" | tee -a test.out +curl --request GET \ + --url "${UBKG_URL}/codes/SNOMEDCT_US%3A254837009X/terms" \ + --header "Accept: application/json" | tee -a test.out +echo | tee -a test.out +echo | tee -a test.out + +echo "2. codes/SNOMEDCT_US%3A254837009/terms?term_typex=PT => invalid parameter; should return custom 404" | tee -a test.out +curl --request GET \ + --url "${UBKG_URL}/codes/SNOMEDCT_US%3A254837009/terms?term_typex=PT" \ + --header "Accept: application/json" | tee -a test.out +echo | tee -a test.out +echo | tee -a test.out + +echo "3. codes/SNOMEDCT_US%3A254837009/terms?term_type=PT => valid; should return 200" | tee -a test.out +curl --request GET \ + --url "${UBKG_URL}/codes/SNOMEDCT_US%3A254837009/terms?term_type=PT" \ + --header "Accept: application/json" | tee -a test.out +echo | tee -a test.out +echo | tee -a test.out + + #-------------------------------------------- echo "TESTS FOR: concepts//codes GET" | tee -a test.out echo "SIGNATURE: /concepts//codes"| tee -a test.out