housekeep: TU rename - Comments

Changes to comments, function descriptions, etc.

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2023-09-10 10:01:21 +02:00
parent 61f1e5b399
commit 87f6791ea8
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
15 changed files with 48 additions and 53 deletions

View file

@ -658,7 +658,7 @@ def test_post_register_with_ssh_pubkey(client: TestClient):
def test_get_account_edit_pm_as_pm(client: TestClient, pm_user: User):
"""Test edit get route of another TU as a TU."""
"""Test edit get route of another PM as a PM."""
with db.begin():
user2 = create_user("test2")
user2.AccountTypeID = at.PACKAGE_MAINTAINER_ID
@ -685,7 +685,7 @@ def test_get_account_edit_pm_as_pm(client: TestClient, pm_user: User):
def test_get_account_edit_as_tu(client: TestClient, pm_user: User):
"""Test edit get route of another user as a TU."""
"""Test edit get route of another user as a PM."""
with db.begin():
user2 = create_user("test2")
@ -1287,14 +1287,14 @@ def test_post_account_edit_other_user_type_as_tu(
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
endpoint = f"/account/{user2.Username}/edit"
# As a TU, we can see the Account Type field for other users.
# As a PM, we can see the Account Type field for other users.
with client as request:
request.cookies = cookies
resp = request.get(endpoint)
assert resp.status_code == int(HTTPStatus.OK)
assert "id_type" in resp.text
# As a TU, we can modify other user's account types.
# As a PM, we can modify other user's account types.
data = {
"U": user2.Username,
"E": user2.Email,
@ -1342,12 +1342,12 @@ def test_post_account_edit_other_user_suspend_as_tu(client: TestClient, pm_user:
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
assert cookies is not None # This is useless, we create the dict here ^
# As a TU, we can see the Account for other users.
# As a PM, we can see the Account for other users.
with client as request:
request.cookies = cookies
resp = request.get(endpoint)
assert resp.status_code == int(HTTPStatus.OK)
# As a TU, we can modify other user's account types.
# As a PM, we can modify other user's account types.
data = {
"U": user.Username,
"E": user.Email,
@ -1383,7 +1383,7 @@ def test_post_account_edit_other_user_type_as_pm_invalid_type(
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
endpoint = f"/account/{user2.Username}/edit"
# As a TU, we can modify other user's account types.
# As a PM, we can modify other user's account types.
data = {"U": user2.Username, "E": user2.Email, "T": 0, "passwd": "testPassword"}
with client as request:
request.cookies = cookies
@ -1598,7 +1598,7 @@ def test_post_accounts_account_type(client: TestClient, user: User, pm_user: Use
assert type.text.strip() == "User"
# Set our only user to a Trusted User.
# Set our only user to a Package Maintainer.
with db.begin():
user.AccountType = (
query(AccountType).filter(AccountType.ID == PACKAGE_MAINTAINER_ID).first()
@ -2065,7 +2065,7 @@ def test_account_delete_self_unauthorized(client: TestClient, pm_user: User):
resp = request.post(endpoint)
assert resp.status_code == HTTPStatus.UNAUTHORIZED
# But a TU does have access
# But a PM does have access
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
with TestClient(app=app) as request:
request.cookies = cookies

View file

@ -567,7 +567,7 @@ ends in less than 48 hours.
def test_notify_main(user: User):
"""Test TU vote reminder through aurweb.notify.main()."""
"""Test PM vote reminder through aurweb.notify.main()."""
set_tu([user])
vote_id = 1

View file

@ -96,9 +96,9 @@ def pm_user():
with db.begin():
pm_user = db.create(
User,
Username="test_tu",
Email="test_tu@example.org",
RealName="Test TU",
Username="test_pm",
Email="test_pm@example.org",
RealName="Test PM",
Passwd="testPassword",
AccountType=pm_type,
)
@ -110,9 +110,9 @@ def pm_user2():
with db.begin():
pm_user2 = db.create(
User,
Username="test_tu2",
Email="test_tu2@example.org",
RealName="Test TU 2",
Username="test_pm2",
Email="test_pm2@example.org",
RealName="Test PM 2",
Passwd="testPassword",
AccountTypeID=PACKAGE_MAINTAINER_ID,
)
@ -307,12 +307,12 @@ def test_pm_stats(client: TestClient, pm_user: User):
stats = root.xpath('//table[@class="no-width"]')[0]
rows = stats.xpath("./tbody/tr")
# We have one trusted user.
# We have one package maintainer.
total = rows[0]
label, count = total.xpath("./td")
assert int(count.text.strip()) == 1
# And we have one active TU.
# And we have one active PM.
active = rows[1]
label, count = active.xpath("./td")
assert int(count.text.strip()) == 1
@ -329,12 +329,12 @@ def test_pm_stats(client: TestClient, pm_user: User):
stats = root.xpath('//table[@class="no-width"]')[0]
rows = stats.xpath("./tbody/tr")
# We have one trusted user.
# We have one package maintainer.
total = rows[0]
label, count = total.xpath("./td")
assert int(count.text.strip()) == 1
# But we have no more active TUs.
# But we have no more active PMs.
active = rows[1]
label, count = active.xpath("./td")
assert int(count.text.strip()) == 0

View file

@ -120,9 +120,9 @@ def pm_user():
with db.begin():
pm_user = db.create(
User,
Username="test_tu",
Username="test_pm",
Email="test_tu@example.org",
RealName="Test TU",
RealName="Test PM",
Passwd="testPassword",
AccountType=pm_type,
)
@ -603,7 +603,7 @@ def test_package_authenticated_maintainer(
for expected_text in expected:
assert expected_text in resp.text
# make sure we don't have these. Only for TUs/Devs
# make sure we don't have these. Only for PMs/Devs
not_expected = [
"1 pending request",
"Delete Package",
@ -1632,7 +1632,7 @@ def test_packages_post_delete(
expected = "You do not have permission to delete packages."
assert errors[0].text.strip() == expected
# Now, let's switch over to making the requests as a TU.
# Now, let's switch over to making the requests as a PM.
# However, this next request will be rejected due to supplying
# an invalid package ID.
pm_cookies = {"AURSID": pm_user.login(Request(), "testPassword")}

View file

@ -123,9 +123,9 @@ def pm_user():
with db.begin():
pm_user = db.create(
User,
Username="test_tu",
Username="test_pm",
Email="test_tu@example.org",
RealName="Test TU",
RealName="Test PM",
Passwd="testPassword",
AccountType=pm_type,
)
@ -1399,7 +1399,7 @@ def test_pkgbase_delete_with_request(
client: TestClient, pm_user: User, pkgbase: PackageBase, pkgreq: PackageRequest
):
# TODO: Test that a previously existing request gets Accepted when
# a TU deleted the package.
# a PM deleted the package.
# Delete the package as `pm_user` via POST request.
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}

View file

@ -919,7 +919,7 @@ def test_requests_with_package_name_filter(
packages: list[Package],
requests: list[PackageRequest],
):
# test as TU
# test as PM
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
with client as request:
request.cookies = cookies
@ -934,7 +934,7 @@ def test_requests_with_package_name_filter(
# We expect 11 requests for all packages containing "kg_1"
assert len(rows) == 11
# test as TU, no results
# test as PM, no results
with client as request:
request.cookies = cookies
resp = request.get(

View file

@ -307,11 +307,11 @@ def test_can_edit_user(
assert not user.can_edit_user(dev_user)
assert not user.can_edit_user(pm_and_dev_user)
# Trusted User can edit.
# Package Maintainer can edit.
assert pm_user.can_edit_user(user)
assert pm_user.can_edit_user(pm_user)
# Trusted User cannot edit.
# Package Maintainer cannot edit.
assert not pm_user.can_edit_user(dev_user)
assert not pm_user.can_edit_user(pm_and_dev_user)
@ -323,7 +323,7 @@ def test_can_edit_user(
# Developer cannot edit.
assert not dev_user.can_edit_user(pm_and_dev_user)
# Trusted User & Developer can edit.
# Package Maintainer & Developer can edit.
assert pm_and_dev_user.can_edit_user(user)
assert pm_and_dev_user.can_edit_user(pm_user)
assert pm_and_dev_user.can_edit_user(dev_user)