@@ -430,10 +430,19 @@ def test_translator_query_unsupported_predicate():
430430 print (j .dumps (query ))
431431 resp = requests .post (url , json = query , timeout = 300 )
432432
433- # Expect HTTP 400 status response
434- assert resp .status_code == 400 , 'Expected an HTTP 400 status response code' \
433+ # Expect HTTP 200 status response
434+ assert resp .status_code == 200 , 'Expected an HTTP 200 status response code' \
435435 f'Received { resp .status_code } : { resp .text } '
436436
437+ # Use the Reasoner Validator Python package to validate against Reasoner Standard API
438+ json = resp .json ()
439+ _validate_trapi_response (json )
440+
441+ # There should be 0 results or null
442+ results = json ['message' ]['results' ]
443+ print (results )
444+ assert results is None or len (results ) == 0 , 'Found results when expecting none' + _print_trapi_log (json )
445+
437446
438447def test_translator_query_bad_predicate ():
439448 """ Check the TRAPI endpoint when using an bad predicate (biolink:correlated). Expect COHD to return a 400 """
@@ -473,9 +482,18 @@ def test_translator_query_bad_predicate():
473482 resp = requests .post (url , json = query , timeout = 300 )
474483
475484 # Expect HTTP 200 status response
476- assert resp .status_code == 400 , 'Expected an HTTP 400 status response code' \
485+ assert resp .status_code == 200 , 'Expected an HTTP 200 status response code' \
477486 f'Received { resp .status_code } : { resp .text } '
478487
488+ # Use the Reasoner Validator Python package to validate against Reasoner Standard API
489+ json = resp .json ()
490+ _validate_trapi_response (json )
491+
492+ # There should be 0 results or null
493+ results = json ['message' ]['results' ]
494+ print (results )
495+ assert results is None or len (results ) == 0 , 'Found results when expecting none' + _print_trapi_log (json )
496+
479497
480498def test_translator_query_q1_multiple_ids ():
481499 """ Check the TRAPI endpoint when using multiple IDs in the subject node. Expect COHD to return 3+ results """
@@ -960,16 +978,30 @@ def test_translator_workflows():
960978 # Test with bad workflows: unsupported operation (overlay)
961979 j_query ['workflow' ] = [{'id' : 'overlay' }]
962980 resp = requests .post (url , json = j_query , timeout = 300 )
963- # Expect HTTP 400 status response
964- assert resp .status_code == 400 , 'Expected an HTTP 400 status response code' \
981+ # Expect HTTP 200 status response
982+ assert resp .status_code == 200 , 'Expected an HTTP 200 status response code' \
965983 f'Received { resp .status_code } : { resp .text } '
984+ # Use the Reasoner Validator Python package to validate against Reasoner Standard API
985+ json = resp .json ()
986+ _validate_trapi_response (json )
987+ # There should be 0 results or null
988+ results = json ['message' ]['results' ]
989+ print (results )
990+ assert results is None or len (results ) == 0 , 'Found results when expecting none' + _print_trapi_log (json )
966991
967992 # Test with bad workflows: multiple lookups
968993 j_query ['workflow' ] = [{'id' : 'lookup' }, {'id' : 'lookup' }]
969994 resp = requests .post (url , json = j_query , timeout = 300 )
970- # Expect HTTP 400 status response
971- assert resp .status_code == 400 , 'Expected an HTTP 400 status response code' \
995+ # Expect HTTP 200 status response
996+ assert resp .status_code == 200 , 'Expected an HTTP 200 status response code' \
972997 f'Received { resp .status_code } : { resp .text } '
998+ # Use the Reasoner Validator Python package to validate against Reasoner Standard API
999+ json = resp .json ()
1000+ _validate_trapi_response (json )
1001+ # There should be 0 results or null
1002+ results = json ['message' ]['results' ]
1003+ print (results )
1004+ assert results is None or len (results ) == 0 , 'Found results when expecting none' + _print_trapi_log (json )
9731005
9741006
9751007def test_translator_meta_knowledge_graph ():
0 commit comments