Skip to content

Commit

Permalink
Feature #22: update tests to check the logout phase
Browse files Browse the repository at this point in the history
  • Loading branch information
stcarrez committed Nov 26, 2022
1 parent 74a8770 commit 2f97ea2
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion awa/regtests/awa-users-tests.adb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ package body AWA.Users.Tests is

-- Check that the user is logged and we have a user principal now.
T.Assert (Request.Get_User_Principal /= null, "A user principal should be defined");

-- Check that the logout removes the principal
Do_Get (Request, Reply, "/auth/logout.html",
"logout-created-user-1.html");
ASF.Tests.Assert_Redirect (T, "/asfunit/auth/login.html",
Reply, "Invalid redirection after logout");

end Test_Create_User;

-- ------------------------------
Expand Down Expand Up @@ -177,8 +184,16 @@ package body AWA.Users.Tests is
end Test_Registration_Disabled;

procedure Test_Logout_User (T : in out Test) is
Request : Servlet.Requests.Mockup.Request;
Reply : Servlet.Responses.Mockup.Response;
begin
null;
Do_Get (Request, Reply, "/auth/logout.html",
"logout.html");

ASF.Tests.Assert_Redirect (T, "/asfunit/auth/login.html",
Reply, "Invalid redirection after logout");
T.Assert (Request.Get_User_Principal = null, "A user principal must be removed");

end Test_Logout_User;

-- ------------------------------
Expand Down

0 comments on commit 2f97ea2

Please sign in to comment.