mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
housekeep: TU rename - Misc
Fix some more test functions Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
d2d47254b4
commit
9e9ba15813
7 changed files with 21 additions and 21 deletions
|
@ -684,7 +684,7 @@ def test_get_account_edit_pm_as_pm(client: TestClient, pm_user: User):
|
|||
assert email.attrib["value"] == user2.Email
|
||||
|
||||
|
||||
def test_get_account_edit_as_tu(client: TestClient, pm_user: User):
|
||||
def test_get_account_edit_as_pm(client: TestClient, pm_user: User):
|
||||
"""Test edit get route of another user as a PM."""
|
||||
with db.begin():
|
||||
user2 = create_user("test2")
|
||||
|
@ -723,9 +723,9 @@ def test_get_account_edit_type(client: TestClient, user: User):
|
|||
assert "id_type" not in response.text
|
||||
|
||||
|
||||
def test_get_account_edit_type_as_tu(client: TestClient, pm_user: User):
|
||||
def test_get_account_edit_type_as_pm(client: TestClient, pm_user: User):
|
||||
with db.begin():
|
||||
user2 = create_user("test_tu")
|
||||
user2 = create_user("test_pm")
|
||||
|
||||
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||
endpoint = f"/account/{user2.Username}/edit"
|
||||
|
@ -795,9 +795,9 @@ def test_post_account_edit(client: TestClient, user: User):
|
|||
assert expected in response.content.decode()
|
||||
|
||||
|
||||
def test_post_account_edit_type_as_tu(client: TestClient, pm_user: User):
|
||||
def test_post_account_edit_type_as_pm(client: TestClient, pm_user: User):
|
||||
with db.begin():
|
||||
user2 = create_user("test_tu")
|
||||
user2 = create_user("test_pm")
|
||||
|
||||
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||
endpoint = f"/account/{user2.Username}/edit"
|
||||
|
@ -833,9 +833,9 @@ def test_post_account_edit_type_as_dev(client: TestClient, pm_user: User):
|
|||
assert user2.AccountTypeID == at.DEVELOPER_ID
|
||||
|
||||
|
||||
def test_post_account_edit_invalid_type_as_tu(client: TestClient, pm_user: User):
|
||||
def test_post_account_edit_invalid_type_as_pm(client: TestClient, pm_user: User):
|
||||
with db.begin():
|
||||
user2 = create_user("test_tu")
|
||||
user2 = create_user("test_pm")
|
||||
pm_user.AccountTypeID = at.PACKAGE_MAINTAINER_ID
|
||||
|
||||
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||
|
@ -1250,7 +1250,7 @@ def test_post_account_edit_other_user_as_user(client: TestClient, user: User):
|
|||
assert resp.headers.get("location") == f"/account/{user2.Username}"
|
||||
|
||||
|
||||
def test_post_account_edit_self_type_as_tu(client: TestClient, pm_user: User):
|
||||
def test_post_account_edit_self_type_as_pm(client: TestClient, pm_user: User):
|
||||
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||
endpoint = f"/account/{pm_user.Username}/edit"
|
||||
|
||||
|
@ -1276,7 +1276,7 @@ def test_post_account_edit_self_type_as_tu(client: TestClient, pm_user: User):
|
|||
assert pm_user.AccountTypeID == USER_ID
|
||||
|
||||
|
||||
def test_post_account_edit_other_user_type_as_tu(
|
||||
def test_post_account_edit_other_user_type_as_pm(
|
||||
client: TestClient, pm_user: User, caplog: pytest.LogCaptureFixture
|
||||
):
|
||||
caplog.set_level(DEBUG)
|
||||
|
@ -1319,7 +1319,7 @@ def test_post_account_edit_other_user_type_as_tu(
|
|||
assert expected in caplog.text
|
||||
|
||||
|
||||
def test_post_account_edit_other_user_suspend_as_tu(client: TestClient, pm_user: User):
|
||||
def test_post_account_edit_other_user_suspend_as_pm(client: TestClient, pm_user: User):
|
||||
with db.begin():
|
||||
user = create_user("test3")
|
||||
# Create a session for user
|
||||
|
@ -2167,7 +2167,7 @@ def test_account_delete_self_with_ssh_public_key(client: TestClient, user: User)
|
|||
assert sshpubkey_record is None
|
||||
|
||||
|
||||
def test_account_delete_as_tu(client: TestClient, pm_user: User):
|
||||
def test_account_delete_as_pm(client: TestClient, pm_user: User):
|
||||
with db.begin():
|
||||
user = create_user("user2")
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ def test_adduser():
|
|||
assert test.login(Request(), "abcd1234")
|
||||
|
||||
|
||||
def test_adduser_tu():
|
||||
def test_adduser_pm():
|
||||
run_main(
|
||||
[
|
||||
"-u",
|
||||
|
|
|
@ -81,7 +81,7 @@ def test_archdev_navbar_authenticated(client: TestClient, user: User):
|
|||
assert item.text.strip() == expected[i]
|
||||
|
||||
|
||||
def test_archdev_navbar_authenticated_tu(client: TestClient, package_maintainer: User):
|
||||
def test_archdev_navbar_authenticated_pm(client: TestClient, package_maintainer: User):
|
||||
expected = [
|
||||
"Dashboard",
|
||||
"Packages",
|
||||
|
|
|
@ -390,7 +390,7 @@ please go to [3] and click "Disable notifications".
|
|||
assert email.body == expected
|
||||
|
||||
|
||||
def set_tu(users: list[User]) -> User:
|
||||
def set_pm(users: list[User]) -> User:
|
||||
with db.begin():
|
||||
for user in users:
|
||||
user.AccountTypeID = PACKAGE_MAINTAINER_ID
|
||||
|
@ -399,7 +399,7 @@ def set_tu(users: list[User]) -> User:
|
|||
def test_open_close_request(
|
||||
user: User, user2: User, pkgreq: PackageRequest, pkgbases: list[PackageBase]
|
||||
):
|
||||
set_tu([user])
|
||||
set_pm([user])
|
||||
pkgbase = pkgbases[0]
|
||||
|
||||
# Send an open request notification.
|
||||
|
@ -545,7 +545,7 @@ This is a test closure comment.
|
|||
|
||||
|
||||
def test_vote_reminders(user: User):
|
||||
set_tu([user])
|
||||
set_pm([user])
|
||||
|
||||
vote_id = 1
|
||||
notif = notify.VoteReminderNotification(vote_id)
|
||||
|
@ -568,7 +568,7 @@ ends in less than 48 hours.
|
|||
|
||||
def test_notify_main(user: User):
|
||||
"""Test PM vote reminder through aurweb.notify.main()."""
|
||||
set_tu([user])
|
||||
set_pm([user])
|
||||
|
||||
vote_id = 1
|
||||
args = ["aurweb-notify", "vote-reminder", str(vote_id)]
|
||||
|
|
|
@ -121,7 +121,7 @@ def pm_user():
|
|||
pm_user = db.create(
|
||||
User,
|
||||
Username="test_pm",
|
||||
Email="test_tu@example.org",
|
||||
Email="test_pm@example.org",
|
||||
RealName="Test PM",
|
||||
Passwd="testPassword",
|
||||
AccountType=pm_type,
|
||||
|
@ -613,7 +613,7 @@ def test_package_authenticated_maintainer(
|
|||
assert unexpected_text not in resp.text
|
||||
|
||||
|
||||
def test_package_authenticated_tu(
|
||||
def test_package_authenticated_pm(
|
||||
client: TestClient, pm_user: User, package: Package, pkgreq: PackageRequest
|
||||
):
|
||||
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||
|
|
|
@ -124,7 +124,7 @@ def pm_user():
|
|||
pm_user = db.create(
|
||||
User,
|
||||
Username="test_pm",
|
||||
Email="test_tu@example.org",
|
||||
Email="test_pm@example.org",
|
||||
RealName="Test PM",
|
||||
Passwd="testPassword",
|
||||
AccountType=pm_type,
|
||||
|
|
|
@ -53,7 +53,7 @@ def user() -> User:
|
|||
|
||||
@pytest.fixture
|
||||
def pm_user() -> User:
|
||||
user = create_user("test_tu", PACKAGE_MAINTAINER_ID)
|
||||
user = create_user("test_pm", PACKAGE_MAINTAINER_ID)
|
||||
yield user
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue