mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
housekeep: TU rename - Comments
Changes to comments, function descriptions, etc. Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
f922f64853
commit
3ee15bfc24
15 changed files with 48 additions and 53 deletions
5
INSTALL
5
INSTALL
|
@ -30,11 +30,6 @@ read the instructions below.
|
||||||
ssl_certificate /etc/ssl/certs/aur.cert.pem;
|
ssl_certificate /etc/ssl/certs/aur.cert.pem;
|
||||||
ssl_certificate_key /etc/ssl/private/aur.key.pem;
|
ssl_certificate_key /etc/ssl/private/aur.key.pem;
|
||||||
|
|
||||||
# TU Bylaws redirect.
|
|
||||||
location = /trusted-user/TUbylaws.html {
|
|
||||||
return 301 https://tu-bylaws.aur.archlinux.org;
|
|
||||||
}
|
|
||||||
|
|
||||||
# smartgit location.
|
# smartgit location.
|
||||||
location ~ "^/([a-z0-9][a-z0-9.+_-]*?)(\.git)?/(git-(receive|upload)-pack|HEAD|info/refs|objects/(info/(http-)?alternates|packs)|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$" {
|
location ~ "^/([a-z0-9][a-z0-9.+_-]*?)(\.git)?/(git-(receive|upload)-pack|HEAD|info/refs|objects/(info/(http-)?alternates|packs)|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$" {
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
|
|
|
@ -20,7 +20,7 @@ from aurweb.templates import make_context, make_variable_context, render_templat
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
logger = aur_logging.get_logger(__name__)
|
logger = aur_logging.get_logger(__name__)
|
||||||
|
|
||||||
# Some TU route specific constants.
|
# Some PM route specific constants.
|
||||||
ITEMS_PER_PAGE = 10 # Paged table size.
|
ITEMS_PER_PAGE = 10 # Paged table size.
|
||||||
MAX_AGENDA_LENGTH = 75 # Agenda table column length.
|
MAX_AGENDA_LENGTH = 75 # Agenda table column length.
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ def render_proposal(
|
||||||
vote: models.TUVote,
|
vote: models.TUVote,
|
||||||
status_code: HTTPStatus = HTTPStatus.OK,
|
status_code: HTTPStatus = HTTPStatus.OK,
|
||||||
):
|
):
|
||||||
"""Render a single TU proposal."""
|
"""Render a single PM proposal."""
|
||||||
context["proposal"] = proposal
|
context["proposal"] = proposal
|
||||||
context["voteinfo"] = voteinfo
|
context["voteinfo"] = voteinfo
|
||||||
context["voters"] = voters.all()
|
context["voters"] = voters.all()
|
||||||
|
@ -368,7 +368,7 @@ async def package_maintainer_addvote_post(
|
||||||
duration, quorum = ADDVOTE_SPECIFICS.get(type)
|
duration, quorum = ADDVOTE_SPECIFICS.get(type)
|
||||||
timestamp = time.utcnow()
|
timestamp = time.utcnow()
|
||||||
|
|
||||||
# Active TU types we filter for.
|
# Active PM types we filter for.
|
||||||
types = {PACKAGE_MAINTAINER_ID, PACKAGE_MAINTAINER_AND_DEV_ID}
|
types = {PACKAGE_MAINTAINER_ID, PACKAGE_MAINTAINER_AND_DEV_ID}
|
||||||
|
|
||||||
# Create a new TUVoteInfo (proposal)!
|
# Create a new TUVoteInfo (proposal)!
|
||||||
|
|
|
@ -159,9 +159,9 @@ commit_url = https://gitlab.archlinux.org/archlinux/aurweb/-/commits/%s
|
||||||
;commit_hash = 1234567
|
;commit_hash = 1234567
|
||||||
|
|
||||||
[tuvotereminder]
|
[tuvotereminder]
|
||||||
; Offsets used to determine when TUs should be reminded about
|
; Offsets used to determine when Package Maintainers should be reminded about
|
||||||
; votes that they should make.
|
; votes that they should make.
|
||||||
; Reminders will be sent out for all votes that a TU has not yet
|
; Reminders will be sent out for all votes that a Package Maintainer has not yet
|
||||||
; voted on based on `now + range_start <= End <= now + range_end`.
|
; voted on based on `now + range_start <= End <= now + range_end`.
|
||||||
range_start = 500
|
range_start = 500
|
||||||
range_end = 172800
|
range_end = 172800
|
||||||
|
|
|
@ -109,7 +109,7 @@ is also recommended to disable automatic garbage collection by setting
|
||||||
receive.autogc to false. Remember to periodically run `git gc` manually or
|
receive.autogc to false. Remember to periodically run `git gc` manually or
|
||||||
setup a maintenance script which initiates the garbage collection if you follow
|
setup a maintenance script which initiates the garbage collection if you follow
|
||||||
this advice. For gc.pruneExpire, we recommend "3.months.ago", such that commits
|
this advice. For gc.pruneExpire, we recommend "3.months.ago", such that commits
|
||||||
that became unreachable by TU intervention are kept for a while.
|
that became unreachable by Package Maintainer intervention are kept for a while.
|
||||||
|
|
||||||
Script Wrappers (poetry)
|
Script Wrappers (poetry)
|
||||||
------------------------
|
------------------------
|
||||||
|
|
|
@ -63,7 +63,7 @@ computations and clean up the database:
|
||||||
packages that are in the official repositories already.
|
packages that are in the official repositories already.
|
||||||
|
|
||||||
* aurweb-tuvotereminder sends out reminders to TUs if the voting period for a
|
* aurweb-tuvotereminder sends out reminders to TUs if the voting period for a
|
||||||
TU proposal ends soon.
|
Package Maintainer proposal ends soon.
|
||||||
|
|
||||||
* aurweb-popupdate is used to recompute the popularity score of packages.
|
* aurweb-popupdate is used to recompute the popularity score of packages.
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ PKG_ID = 1 # Packages.ID of first package
|
||||||
# how many users to 'register'
|
# how many users to 'register'
|
||||||
MAX_USERS = int(os.environ.get("MAX_USERS", 38000))
|
MAX_USERS = int(os.environ.get("MAX_USERS", 38000))
|
||||||
MAX_DEVS = 0.1 # what percentage of MAX_USERS are Developers
|
MAX_DEVS = 0.1 # what percentage of MAX_USERS are Developers
|
||||||
MAX_TUS = 0.2 # what percentage of MAX_USERS are Package Maintainers
|
MAX_PMS = 0.2 # what percentage of MAX_USERS are Package Maintainers
|
||||||
# how many packages to load
|
# how many packages to load
|
||||||
MAX_PKGS = int(os.environ.get("MAX_PKGS", 32000))
|
MAX_PKGS = int(os.environ.get("MAX_PKGS", 32000))
|
||||||
PKG_DEPS = (1, 15) # min/max depends a package has
|
PKG_DEPS = (1, 15) # min/max depends a package has
|
||||||
|
@ -35,9 +35,9 @@ PKG_SRC = (1, 3) # min/max sources a package has
|
||||||
PKG_CMNTS = (1, 5) # min/max number of comments a package has
|
PKG_CMNTS = (1, 5) # min/max number of comments a package has
|
||||||
CATEGORIES_COUNT = 17 # the number of categories from aur-schema
|
CATEGORIES_COUNT = 17 # the number of categories from aur-schema
|
||||||
VOTING = (0, 0.001) # percentage range for package voting
|
VOTING = (0, 0.001) # percentage range for package voting
|
||||||
# number of open trusted user proposals
|
# number of open package maintainer proposals
|
||||||
OPEN_PROPOSALS = int(os.environ.get("OPEN_PROPOSALS", 15))
|
OPEN_PROPOSALS = int(os.environ.get("OPEN_PROPOSALS", 15))
|
||||||
# number of closed trusted user proposals
|
# number of closed package maintainer proposals
|
||||||
CLOSE_PROPOSALS = int(os.environ.get("CLOSE_PROPOSALS", 50))
|
CLOSE_PROPOSALS = int(os.environ.get("CLOSE_PROPOSALS", 50))
|
||||||
RANDOM_TLDS = ("edu", "com", "org", "net", "tw", "ru", "pl", "de", "es")
|
RANDOM_TLDS = ("edu", "com", "org", "net", "tw", "ru", "pl", "de", "es")
|
||||||
RANDOM_URL = ("http://www.", "ftp://ftp.", "http://", "ftp://")
|
RANDOM_URL = ("http://www.", "ftp://ftp.", "http://", "ftp://")
|
||||||
|
@ -153,7 +153,7 @@ while len(seen_pkgs) < MAX_PKGS:
|
||||||
#
|
#
|
||||||
contents = None
|
contents = None
|
||||||
|
|
||||||
# developer/tu IDs
|
# developer/PM IDs
|
||||||
#
|
#
|
||||||
developers = []
|
developers = []
|
||||||
packagemaintainers = []
|
packagemaintainers = []
|
||||||
|
@ -179,10 +179,10 @@ for u in user_keys:
|
||||||
if len(developers) >= MAX_DEVS * MAX_USERS:
|
if len(developers) >= MAX_DEVS * MAX_USERS:
|
||||||
has_devs = 1
|
has_devs = 1
|
||||||
elif account_type == 2 and not has_pms:
|
elif account_type == 2 and not has_pms:
|
||||||
# this will be a trusted user account
|
# this will be a package maintainer account
|
||||||
#
|
#
|
||||||
packagemaintainers.append(seen_users[u])
|
packagemaintainers.append(seen_users[u])
|
||||||
if len(packagemaintainers) >= MAX_TUS * MAX_USERS:
|
if len(packagemaintainers) >= MAX_PMS * MAX_USERS:
|
||||||
has_pms = 1
|
has_pms = 1
|
||||||
else:
|
else:
|
||||||
# a normal user account
|
# a normal user account
|
||||||
|
@ -339,7 +339,7 @@ for p in seen_pkgs_keys:
|
||||||
s = s % (seen_pkgs[p], src)
|
s = s % (seen_pkgs[p], src)
|
||||||
out.write(s)
|
out.write(s)
|
||||||
|
|
||||||
# Create trusted user proposals
|
# Create package maintainer proposals
|
||||||
#
|
#
|
||||||
log.debug("Creating SQL statements for package maintainer proposals.")
|
log.debug("Creating SQL statements for package maintainer proposals.")
|
||||||
count = 0
|
count = 0
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ table td.country {
|
||||||
stroke-width: 1.5px;
|
stroke-width: 1.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dev/TU biographies */
|
/* dev/PM biographies */
|
||||||
#arch-bio-toc {
|
#arch-bio-toc {
|
||||||
width: 75%;
|
width: 75%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
|
@ -179,7 +179,7 @@
|
||||||
{{ "Locked" | tr }}
|
{{ "Locked" | tr }}
|
||||||
({{ time_left_fmt }})
|
({{ time_left_fmt }})
|
||||||
{% else %}
|
{% else %}
|
||||||
{# Only elevated users (TU or Dev) are allowed to accept requests. #}
|
{# Only elevated users (PM or Dev) are allowed to accept requests. #}
|
||||||
<a href="/pkgbase/{{ result.PackageBaseName }}/{{ action }}?{{ temp_q | urlencode }}">
|
<a href="/pkgbase/{{ result.PackageBaseName }}/{{ action }}?{{ temp_q | urlencode }}">
|
||||||
{{ "Accept" | tr }}
|
{{ "Accept" | tr }}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -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):
|
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():
|
with db.begin():
|
||||||
user2 = create_user("test2")
|
user2 = create_user("test2")
|
||||||
user2.AccountTypeID = at.PACKAGE_MAINTAINER_ID
|
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):
|
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():
|
with db.begin():
|
||||||
user2 = create_user("test2")
|
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")}
|
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||||
endpoint = f"/account/{user2.Username}/edit"
|
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:
|
with client as request:
|
||||||
request.cookies = cookies
|
request.cookies = cookies
|
||||||
resp = request.get(endpoint)
|
resp = request.get(endpoint)
|
||||||
assert resp.status_code == int(HTTPStatus.OK)
|
assert resp.status_code == int(HTTPStatus.OK)
|
||||||
assert "id_type" in resp.text
|
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 = {
|
data = {
|
||||||
"U": user2.Username,
|
"U": user2.Username,
|
||||||
"E": user2.Email,
|
"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")}
|
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||||
assert cookies is not None # This is useless, we create the dict here ^
|
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:
|
with client as request:
|
||||||
request.cookies = cookies
|
request.cookies = cookies
|
||||||
resp = request.get(endpoint)
|
resp = request.get(endpoint)
|
||||||
assert resp.status_code == int(HTTPStatus.OK)
|
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 = {
|
data = {
|
||||||
"U": user.Username,
|
"U": user.Username,
|
||||||
"E": user.Email,
|
"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")}
|
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||||
endpoint = f"/account/{user2.Username}/edit"
|
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"}
|
data = {"U": user2.Username, "E": user2.Email, "T": 0, "passwd": "testPassword"}
|
||||||
with client as request:
|
with client as request:
|
||||||
request.cookies = cookies
|
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"
|
assert type.text.strip() == "User"
|
||||||
|
|
||||||
# Set our only user to a Trusted User.
|
# Set our only user to a Package Maintainer.
|
||||||
with db.begin():
|
with db.begin():
|
||||||
user.AccountType = (
|
user.AccountType = (
|
||||||
query(AccountType).filter(AccountType.ID == PACKAGE_MAINTAINER_ID).first()
|
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)
|
resp = request.post(endpoint)
|
||||||
assert resp.status_code == HTTPStatus.UNAUTHORIZED
|
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")}
|
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||||
with TestClient(app=app) as request:
|
with TestClient(app=app) as request:
|
||||||
request.cookies = cookies
|
request.cookies = cookies
|
||||||
|
|
|
@ -567,7 +567,7 @@ ends in less than 48 hours.
|
||||||
|
|
||||||
|
|
||||||
def test_notify_main(user: User):
|
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])
|
set_tu([user])
|
||||||
|
|
||||||
vote_id = 1
|
vote_id = 1
|
||||||
|
|
|
@ -96,9 +96,9 @@ def pm_user():
|
||||||
with db.begin():
|
with db.begin():
|
||||||
pm_user = db.create(
|
pm_user = db.create(
|
||||||
User,
|
User,
|
||||||
Username="test_tu",
|
Username="test_pm",
|
||||||
Email="test_tu@example.org",
|
Email="test_pm@example.org",
|
||||||
RealName="Test TU",
|
RealName="Test PM",
|
||||||
Passwd="testPassword",
|
Passwd="testPassword",
|
||||||
AccountType=pm_type,
|
AccountType=pm_type,
|
||||||
)
|
)
|
||||||
|
@ -110,9 +110,9 @@ def pm_user2():
|
||||||
with db.begin():
|
with db.begin():
|
||||||
pm_user2 = db.create(
|
pm_user2 = db.create(
|
||||||
User,
|
User,
|
||||||
Username="test_tu2",
|
Username="test_pm2",
|
||||||
Email="test_tu2@example.org",
|
Email="test_pm2@example.org",
|
||||||
RealName="Test TU 2",
|
RealName="Test PM 2",
|
||||||
Passwd="testPassword",
|
Passwd="testPassword",
|
||||||
AccountTypeID=PACKAGE_MAINTAINER_ID,
|
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]
|
stats = root.xpath('//table[@class="no-width"]')[0]
|
||||||
rows = stats.xpath("./tbody/tr")
|
rows = stats.xpath("./tbody/tr")
|
||||||
|
|
||||||
# We have one trusted user.
|
# We have one package maintainer.
|
||||||
total = rows[0]
|
total = rows[0]
|
||||||
label, count = total.xpath("./td")
|
label, count = total.xpath("./td")
|
||||||
assert int(count.text.strip()) == 1
|
assert int(count.text.strip()) == 1
|
||||||
|
|
||||||
# And we have one active TU.
|
# And we have one active PM.
|
||||||
active = rows[1]
|
active = rows[1]
|
||||||
label, count = active.xpath("./td")
|
label, count = active.xpath("./td")
|
||||||
assert int(count.text.strip()) == 1
|
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]
|
stats = root.xpath('//table[@class="no-width"]')[0]
|
||||||
rows = stats.xpath("./tbody/tr")
|
rows = stats.xpath("./tbody/tr")
|
||||||
|
|
||||||
# We have one trusted user.
|
# We have one package maintainer.
|
||||||
total = rows[0]
|
total = rows[0]
|
||||||
label, count = total.xpath("./td")
|
label, count = total.xpath("./td")
|
||||||
assert int(count.text.strip()) == 1
|
assert int(count.text.strip()) == 1
|
||||||
|
|
||||||
# But we have no more active TUs.
|
# But we have no more active PMs.
|
||||||
active = rows[1]
|
active = rows[1]
|
||||||
label, count = active.xpath("./td")
|
label, count = active.xpath("./td")
|
||||||
assert int(count.text.strip()) == 0
|
assert int(count.text.strip()) == 0
|
||||||
|
|
|
@ -120,9 +120,9 @@ def pm_user():
|
||||||
with db.begin():
|
with db.begin():
|
||||||
pm_user = db.create(
|
pm_user = db.create(
|
||||||
User,
|
User,
|
||||||
Username="test_tu",
|
Username="test_pm",
|
||||||
Email="test_tu@example.org",
|
Email="test_tu@example.org",
|
||||||
RealName="Test TU",
|
RealName="Test PM",
|
||||||
Passwd="testPassword",
|
Passwd="testPassword",
|
||||||
AccountType=pm_type,
|
AccountType=pm_type,
|
||||||
)
|
)
|
||||||
|
@ -603,7 +603,7 @@ def test_package_authenticated_maintainer(
|
||||||
for expected_text in expected:
|
for expected_text in expected:
|
||||||
assert expected_text in resp.text
|
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 = [
|
not_expected = [
|
||||||
"1 pending request",
|
"1 pending request",
|
||||||
"Delete Package",
|
"Delete Package",
|
||||||
|
@ -1632,7 +1632,7 @@ def test_packages_post_delete(
|
||||||
expected = "You do not have permission to delete packages."
|
expected = "You do not have permission to delete packages."
|
||||||
assert errors[0].text.strip() == expected
|
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
|
# However, this next request will be rejected due to supplying
|
||||||
# an invalid package ID.
|
# an invalid package ID.
|
||||||
pm_cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
pm_cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||||
|
|
|
@ -123,9 +123,9 @@ def pm_user():
|
||||||
with db.begin():
|
with db.begin():
|
||||||
pm_user = db.create(
|
pm_user = db.create(
|
||||||
User,
|
User,
|
||||||
Username="test_tu",
|
Username="test_pm",
|
||||||
Email="test_tu@example.org",
|
Email="test_tu@example.org",
|
||||||
RealName="Test TU",
|
RealName="Test PM",
|
||||||
Passwd="testPassword",
|
Passwd="testPassword",
|
||||||
AccountType=pm_type,
|
AccountType=pm_type,
|
||||||
)
|
)
|
||||||
|
@ -1399,7 +1399,7 @@ def test_pkgbase_delete_with_request(
|
||||||
client: TestClient, pm_user: User, pkgbase: PackageBase, pkgreq: PackageRequest
|
client: TestClient, pm_user: User, pkgbase: PackageBase, pkgreq: PackageRequest
|
||||||
):
|
):
|
||||||
# TODO: Test that a previously existing request gets Accepted when
|
# 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.
|
# Delete the package as `pm_user` via POST request.
|
||||||
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||||
|
|
|
@ -919,7 +919,7 @@ def test_requests_with_package_name_filter(
|
||||||
packages: list[Package],
|
packages: list[Package],
|
||||||
requests: list[PackageRequest],
|
requests: list[PackageRequest],
|
||||||
):
|
):
|
||||||
# test as TU
|
# test as PM
|
||||||
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
cookies = {"AURSID": pm_user.login(Request(), "testPassword")}
|
||||||
with client as request:
|
with client as request:
|
||||||
request.cookies = cookies
|
request.cookies = cookies
|
||||||
|
@ -934,7 +934,7 @@ def test_requests_with_package_name_filter(
|
||||||
# We expect 11 requests for all packages containing "kg_1"
|
# We expect 11 requests for all packages containing "kg_1"
|
||||||
assert len(rows) == 11
|
assert len(rows) == 11
|
||||||
|
|
||||||
# test as TU, no results
|
# test as PM, no results
|
||||||
with client as request:
|
with client as request:
|
||||||
request.cookies = cookies
|
request.cookies = cookies
|
||||||
resp = request.get(
|
resp = request.get(
|
||||||
|
|
|
@ -307,11 +307,11 @@ def test_can_edit_user(
|
||||||
assert not user.can_edit_user(dev_user)
|
assert not user.can_edit_user(dev_user)
|
||||||
assert not user.can_edit_user(pm_and_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(user)
|
||||||
assert pm_user.can_edit_user(pm_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(dev_user)
|
||||||
assert not pm_user.can_edit_user(pm_and_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.
|
# Developer cannot edit.
|
||||||
assert not dev_user.can_edit_user(pm_and_dev_user)
|
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(user)
|
||||||
assert pm_and_dev_user.can_edit_user(pm_user)
|
assert pm_and_dev_user.can_edit_user(pm_user)
|
||||||
assert pm_and_dev_user.can_edit_user(dev_user)
|
assert pm_and_dev_user.can_edit_user(dev_user)
|
||||||
|
|
Loading…
Add table
Reference in a new issue