mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(fastapi): render Logged-in as page on authenticated /login
This was missed during the initial porting of the /login route. Modifications: ------------- - A form is now used for the [Logout] link and some css was needed to deal with positioning. Closes #186 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
fd8d23a379
commit
9bfe2b07ba
4 changed files with 104 additions and 79 deletions
|
@ -131,7 +131,7 @@ def test_secure_login(mock):
|
|||
assert user.session == record
|
||||
|
||||
|
||||
def test_authenticated_login_forbidden():
|
||||
def test_authenticated_login():
|
||||
post_data = {
|
||||
"user": "test",
|
||||
"passwd": "testPassword",
|
||||
|
@ -139,15 +139,19 @@ def test_authenticated_login_forbidden():
|
|||
}
|
||||
|
||||
with client as request:
|
||||
# Login.
|
||||
# Try to login.
|
||||
response = request.post("/login", data=post_data,
|
||||
allow_redirects=False)
|
||||
assert response.status_code == int(HTTPStatus.SEE_OTHER)
|
||||
assert response.headers.get("location") == "/"
|
||||
|
||||
# Now, let's verify that we get the logged in rendering
|
||||
# when requesting GET /login as an authenticated user.
|
||||
# Now, let's verify that we receive 403 Forbidden when we
|
||||
# try to get /login as an authenticated user.
|
||||
response = request.get("/login", allow_redirects=False)
|
||||
assert response.status_code == int(HTTPStatus.SEE_OTHER)
|
||||
assert response.status_code == int(HTTPStatus.OK)
|
||||
assert "Logged-in as: <strong>test</strong>" in response.text
|
||||
|
||||
|
||||
def test_unauthenticated_logout_unauthorized():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue