Fix robot tests

This commit is contained in:
Zoe Roux 2024-10-19 18:07:20 +02:00
parent 79b685ea8a
commit 49fc88667a
No known key found for this signature in database
4 changed files with 15 additions and 8 deletions

View File

@ -8,10 +8,10 @@ Library REST http://localhost:8901/auth
Login
[Documentation] Shortcut to login with the given username for future requests
[Arguments] ${username}
&{res}= POST /sessions {"username": "${username}", "password": "password-${username}"}
&{res}= POST /sessions {"login": "${username}", "password": "password-${username}"}
Output
Integer response status 201
String response body access_token
String response body token
ConvertToJwt ${res.body.token}
Register
@ -29,11 +29,11 @@ ConvertToJwt
[Documentation] Convert a session token to a jwt and set it in the header
[Arguments] ${token}
Set Headers {"Authorization": "Bearer ${token}"}
${res}= GET /jwt
&{res}= GET /jwt
Output
Integer response status 200
String response body token
Set Headers {"Authorization": "Bearer ${res.token}"}
Set Headers {"Authorization": "Bearer ${res.body.token}"}
Logout
[Documentation] Logout the current user, only the local client is affected.

View File

@ -9,7 +9,15 @@ Bad Account
[Documentation] Login fails if user does not exist
POST /sessions {"login": "i-don-t-exist", "password": "pass"}
Output
Integer response status 404
Invalid password
[Documentation] Login fails if password is invalid
Register invalid-password-user
POST /sessions {"login": "invalid-password-user", "password": "pass"}
Output
Integer response status 403
[Teardown] DELETE /users/me
Login
[Documentation] Create a new user and login in it
@ -18,7 +26,6 @@ Login
Output
Integer response status 200
String response body username login-user
Logout
Login login-user
${me}= Get /users/me
@ -26,4 +33,4 @@ Login
Output ${me}
Should Be Equal As Strings ${res["body"]} ${me["body"]}
[Teardown] DELETE /auth/me
[Teardown] DELETE /users/me

View File

@ -20,7 +20,7 @@ Register Duplicates
[Documentation] If two users tries to register with the same username, it fails
Register user-duplicate
# We can't use the `Register` keyword because it assert for success
POST /auth/register {"username": "user-duplicate", "password": "pass", "email": "mail@zoriya.dev"}
POST /users {"username": "user-duplicate", "password": "pass", "email": "mail@zoriya.dev"}
Output
Integer response status 409
[Teardown] DELETE /users/me

View File

@ -12,7 +12,7 @@
msgspec
langcodes
robotframework
# robotframework
# restinstance needs to be packaged
]);
dotnet = with pkgs.dotnetCorePackages;