import Client from urls import * from uuid import uuid4 def test(value, expected_value, title, description = None): if (value == expected_value): print(title, "[OK]") return print (title, "[ERROR]") print ("expected", expected_value, ", got", value) if not description is None: print (description) def test_accounts_register(client, username, password): print ("REGISTER") test(client.accounts.create(username, password), b'ok: user added', 'normal', None) print() def test_accounts_login(client, username, password): print ("LOGIN") test(client.login(username, password), b'ok: account valid', "normal", None) print() def test_accounts_delete(client): print ("DELETE") test(client.accounts.delete(), b'ok: account has been deleted', 'normal') print() def test_profile_get(client): pass def tests(): username = uuid4() password = uuid4() client = Client.Client("http://0.0.0.0:8000/") test_accounts_register(client, username, password) test_accounts_login(client, username, password) test_accounts_delete(client) test_profile_get(client) if __name__ == "__main__": tests()