Better testing comments

This commit is contained in:
Imbus 2024-03-17 03:46:16 +01:00
parent 2e44d14370
commit b69f8d82ff

View file

@ -22,7 +22,7 @@ loginPath = base_url + "/api/login"
addProjectPath = base_url + "/api/project" addProjectPath = base_url + "/api/project"
# Define a function to prform POST request with data and return response # Posts the username and password to the register endpoint
def register(username: string, password: string): def register(username: string, password: string):
print("Registering with username: ", username, " and password: ", password) print("Registering with username: ", username, " and password: ", password)
response = requests.post( response = requests.post(
@ -32,6 +32,7 @@ def register(username: string, password: string):
return response return response
# Posts the username and password to the login endpoint
def login(username: string, password: string): def login(username: string, password: string):
print("Logging in with username: ", username, " and password: ", password) print("Logging in with username: ", username, " and password: ", password)
response = requests.post( response = requests.post(
@ -48,7 +49,6 @@ def test_login():
return response.json()["token"] return response.json()["token"]
# Define a function to test the POST request
def test_create_user(): def test_create_user():
response = register(username, "always_same") response = register(username, "always_same")
assert response.status_code == 200, "Registration failed" assert response.status_code == 200, "Registration failed"