You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.9 KiB
Python
48 lines
1.9 KiB
Python
from tests.createAPI.create_delete_art import run_art_test, list_art, delete_art_entries
|
|
from tests.createAPI.create_delete_presence import run_presence_test, list_presences
|
|
from tests.createAPI.create_delete_artist import delete_artist_entries, list_artists, run_artist_test
|
|
|
|
from tests.relationAPI.relate_art import run_art_presence_relation_test
|
|
|
|
|
|
def run_tests(url: str, port: int):
|
|
"""
|
|
Run unit tests against all API interfaces
|
|
:param url:
|
|
:param port:
|
|
:return:
|
|
"""
|
|
if len(list_artists(url, port)) > 0:
|
|
print("Deleting leftover artists ...")
|
|
delete_artist_entries(url, port)
|
|
if len(list_art(url, port)) > 0:
|
|
print("Deleting leftover art ...")
|
|
delete_art_entries(url, port)
|
|
|
|
create_artist_result, delete_artist_result = run_artist_test(url, port)
|
|
create_presence_result, delete_presence_result, cascade_delete_presence_result = run_presence_test(url, port)
|
|
create_art_result, update_art_result, delete_art_result = run_art_test(url, port)
|
|
|
|
print()
|
|
print("-------- Test Results ---------")
|
|
print("Leftover DB Objects:")
|
|
r = list_artists(url, port)
|
|
print(f"Artists: {len(r)}, {r}")
|
|
r = list_presences(url, port)
|
|
print(f"Presences: {len(r)}, {r}")
|
|
r = list_art(url, port)
|
|
print(f"Art: {len(r)}, {r}")
|
|
print()
|
|
print("Functions:")
|
|
print(f"Artists: \tCreate: {create_artist_result} \tUpdate: {'N/A'} \tDelete: {delete_artist_result} \t(Direct)")
|
|
print(f"Presences: \tCreate: {create_presence_result} \tUpdate: {'N/A'} "
|
|
f"\tDelete: {delete_presence_result} \t(Direct), {cascade_delete_presence_result} \t(cascade@artist)")
|
|
print(f"Art: \t\tCreate: {create_art_result} \tUpdate: {update_art_result} "
|
|
f"\tDelete: {delete_art_result} \t(Direct)")
|
|
print("-------------------------------")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
#run_tests("127.0.0.1", 8000)
|
|
run_art_presence_relation_test("127.0.0.1", 8000)
|