diff --git a/tests/accounts.py b/tests/accounts.py index 6c0941a..335a193 100644 --- a/tests/accounts.py +++ b/tests/accounts.py @@ -5,7 +5,7 @@ from tests.utils import test def test_accounts_register(client, username, password): print ("REGISTER") - test(client.accounts.create(username, password), b'ok: user added', 'normal', None) + test(client.accounts.create, (username, password), b'ok: user added', 'normal', None) print() @@ -13,7 +13,7 @@ def test_accounts_login(client, username, password): print ("LOGIN") - test(client.login(username, password), b'ok: account valid', "normal", None) + test(client.login, (username, password), b'ok: account valid', "normal", None) print() @@ -21,7 +21,7 @@ def test_accounts_delete(client): print ("DELETE") - test(client.accounts.delete(), b'ok: account has been deleted', 'normal') + test(client.accounts.delete, (), b'ok: account has been deleted', 'normal') print() diff --git a/tests/profiles.py b/tests/profiles.py index d0e2290..7cddfa7 100644 --- a/tests/profiles.py +++ b/tests/profiles.py @@ -10,7 +10,7 @@ def test_profiles_get(client): print ("GET") - test(client.profiles.get(1), Profile(username="997e13f5-474d-4fea-b55a-ad8a27b9534b", title=""), "normal") + test(client.profiles.get, (1, ), Profile(username="997e13f5-474d-4fea-b55a-ad8a27b9534b", title=""), "normal") print() diff --git a/tests/utils.py b/tests/utils.py index 5a4fd97..11914b5 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,6 +1,6 @@ -def test(value, expected_value, title, description = None): +def test(func: callable, params, expected_value, title: str, description = None): print(title, end=" ") - if (value == expected_value): + if (func(*params) == expected_value): print("[OK]") return print ("[ERROR]")