diff --git a/auth/robot/auth.resource b/auth/robot/auth.resource index 32f284a0..51298261 100644 --- a/auth/robot/auth.resource +++ b/auth/robot/auth.resource @@ -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. diff --git a/auth/robot/sessions.robot b/auth/robot/sessions.robot index d5b880d1..6f6b7f1b 100644 --- a/auth/robot/sessions.robot +++ b/auth/robot/sessions.robot @@ -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 diff --git a/auth/robot/users.robot b/auth/robot/users.robot index 96d8b3f9..603fd1ec 100644 --- a/auth/robot/users.robot +++ b/auth/robot/users.robot @@ -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 diff --git a/shell.nix b/shell.nix index 3d413798..51dcdd54 100644 --- a/shell.nix +++ b/shell.nix @@ -12,7 +12,7 @@ msgspec langcodes - robotframework + # robotframework # restinstance needs to be packaged ]); dotnet = with pkgs.dotnetCorePackages;