Skip to content

Commit

Permalink
tests for codes/{code_id}/terms
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanSimmons committed Jul 28, 2024
1 parent e0f75d2 commit f6a698f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/ubkg_api/common_routes/common_neo4j_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 27 additions & 0 deletions tests/test_dd_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,33 @@ curl --request GET \
echo | tee -a test.out
echo | tee -a test.out

#--------------------------------------------
echo "TESTS FOR: codes/<code_id>/terms" | tee -a test.out
echo "SIGNATURE: /codes/<code_id>/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/<concept_id>/codes GET" | tee -a test.out
echo "SIGNATURE: /concepts/<concept_id>/codes"| tee -a test.out
Expand Down
28 changes: 28 additions & 0 deletions tests/test_ubkg_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,34 @@ curl --request GET \
echo | tee -a test.out
echo | tee -a test.out

#--------------------------------------------
echo "TESTS FOR: codes/<code_id>/terms" | tee -a test.out
echo "SIGNATURE: /codes/<code_id>/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/<concept_id>/codes GET" | tee -a test.out
echo "SIGNATURE: /concepts/<concept_id>/codes"| tee -a test.out
Expand Down

0 comments on commit f6a698f

Please sign in to comment.