From 176668c4a1e7c949cbdb4ba387b7f187701e8db5 Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Sat, 7 Jan 2023 14:28:48 -0600 Subject: Start refactor --- tests.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'tests.py') diff --git a/tests.py b/tests.py index 33c9f6d..32511c8 100755 --- a/tests.py +++ b/tests.py @@ -106,7 +106,7 @@ def test_json_post_posts(): j = r.json() assert len(j) == 1 - assert "title" == j[0]["title"] + assert "title" == j[0]["title"] assert "body" == j[0]["body"] url = f"{BASE_URL}/posts/{uuid_}" @@ -115,7 +115,7 @@ def test_json_post_posts(): j = r.json() assert len(j) == 1 - assert "title" == j[0]["title"] + assert "title" == j[0]["title"] assert "body" == j[0]["body"] @@ -136,11 +136,17 @@ def test_json_get_post_not_found(): def main(): + winner = True for func in dir(sys.modules[__name__]): if func.startswith("test_"): - globals()[func]() - - print("🏆 You're winner !") + try: + globals()[func]() + except Exception: + winner = False + print(f"{func} failed.") + + if winner: + print("🏆 You're winner !") if __name__ == "__main__": -- cgit v1.2.3