mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 18:23:57 +01:00
making tests properly handle exceptions
This commit is contained in:
parent
70c8dec419
commit
13416802cb
|
@ -92,24 +92,27 @@ def test_api_moderation() -> dict:
|
||||||
|
|
||||||
def test_all():
|
def test_all():
|
||||||
"""Runs all tests."""
|
"""Runs all tests."""
|
||||||
|
try:
|
||||||
|
print("Waiting until API Server is started up...")
|
||||||
|
time.sleep(6)
|
||||||
|
|
||||||
print("Waiting until API Server is started up...")
|
print('[lightblue]Running test on API server to check if its running...')
|
||||||
time.sleep(6)
|
print(test_server())
|
||||||
|
|
||||||
print('[lightblue]Running test on API server to check if its running...')
|
print('[lightblue]Running a api endpoint to see if requests can go through...')
|
||||||
print(test_server())
|
print(test_api('gpt-3.5-trubo'))
|
||||||
|
|
||||||
print('[lightblue]Running a api endpoint to see if requests can go through...')
|
print('[lightblue]Checking if the API works with the python library...')
|
||||||
print(test_api('gpt-3.5-trubo'))
|
print(test_library())
|
||||||
|
|
||||||
print('[lightblue]Checking if the API works with the python library...')
|
print('[lightblue]Checking if the moderation endpoint works...')
|
||||||
print(test_library())
|
print(test_library_moderation())
|
||||||
|
|
||||||
print('[lightblue]Checking if the moderation endpoint works...')
|
print('[lightblue]Checking the /v1/models endpoint...')
|
||||||
print(test_library_moderation())
|
print(test_models())
|
||||||
|
except Exception as e:
|
||||||
print('[lightblue]Checking the /v1/models endpoint...')
|
print('[red]Error: ' + e)
|
||||||
print(test_models())
|
exit(500)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
closedai.api_base = api_endpoint
|
closedai.api_base = api_endpoint
|
||||||
|
|
Loading…
Reference in a new issue