add: register test

This commit is contained in:
starnakin 2023-11-03 21:04:38 +01:00
parent 80e638072f
commit 92da8114c3
3 changed files with 31 additions and 10 deletions

31
src/tests.py Normal file
View File

@ -0,0 +1,31 @@
import Client
from urls import *
from uuid import uuid4
def test(value, expected_value, title, description):
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():
username = uuid4()
password = uuid4()
client = Client.Client("http://0.0.0.0:8000/")
print ("REGISTER")
test(client.register(username, password), b'ok: user added', 'normal register', None)
print()
def tests():
test_accounts_register()
if __name__ == "__main__":
tests()

View File

@ -1,10 +0,0 @@
from unittest import TestCase
import uuid
class RegisterTest(TestCase):
def setUp(self):
self.username: str = uuid.uuid4()
self.password: str = uuid.uuid4()
def test_valid