mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(python): use S argument to decide Suspended
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
0ed752277c
commit
cf978e23aa
2 changed files with 30 additions and 4 deletions
|
@ -814,7 +814,6 @@ def test_post_account_edit_inactivity(client: TestClient, user: User):
|
|||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
# Make sure the user record got updated correctly.
|
||||
assert user.Suspended
|
||||
assert user.InactivityTS > 0
|
||||
|
||||
post_data.update({"J": False})
|
||||
|
@ -823,10 +822,37 @@ def test_post_account_edit_inactivity(client: TestClient, user: User):
|
|||
cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
assert not user.Suspended
|
||||
assert user.InactivityTS == 0
|
||||
|
||||
|
||||
def test_post_account_edit_suspended(client: TestClient, user: User):
|
||||
with db.begin():
|
||||
user.AccountTypeID = TRUSTED_USER_ID
|
||||
assert not user.Suspended
|
||||
|
||||
cookies = {"AURSID": user.login(Request(), "testPassword")}
|
||||
post_data = {
|
||||
"U": "test",
|
||||
"E": "test@example.org",
|
||||
"S": True,
|
||||
"passwd": "testPassword"
|
||||
}
|
||||
endpoint = f"/account/{user.Username}/edit"
|
||||
with client as request:
|
||||
resp = request.post(endpoint, data=post_data, cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
# Make sure the user record got updated correctly.
|
||||
assert user.Suspended
|
||||
|
||||
post_data.update({"S": False})
|
||||
with client as request:
|
||||
resp = request.post(endpoint, data=post_data, cookies=cookies)
|
||||
assert resp.status_code == int(HTTPStatus.OK)
|
||||
|
||||
assert not user.Suspended
|
||||
|
||||
|
||||
def test_post_account_edit_error_unauthorized(client: TestClient, user: User):
|
||||
request = Request()
|
||||
sid = user.login(request, "testPassword")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue