mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change(FastAPI): @auth_required login kwarg defaulted to True
We pretty much want @auth_required to send users to login if we enforce auth requirements but don't otherwise specify a way to deal with it. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
dc11a88ed3
commit
2e6f8cb9f4
5 changed files with 35 additions and 32 deletions
|
@ -9,7 +9,7 @@ import pytest
|
|||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from aurweb import db
|
||||
from aurweb import db, util
|
||||
from aurweb.models.account_type import AccountType
|
||||
from aurweb.models.tu_vote import TUVote
|
||||
from aurweb.models.tu_voteinfo import TUVoteInfo
|
||||
|
@ -128,7 +128,9 @@ def test_tu_index_guest(client):
|
|||
with client as request:
|
||||
response = request.get("/tu", allow_redirects=False)
|
||||
assert response.status_code == int(HTTPStatus.SEE_OTHER)
|
||||
assert response.headers.get("location") == "/"
|
||||
|
||||
params = util.urlencode({"next": "/tu"})
|
||||
assert response.headers.get("location") == f"/login?{params}"
|
||||
|
||||
|
||||
def test_tu_index_unauthorized(client, user):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue