mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change: remove comaintainers when fulfilling orphan request
Closes FS#50079 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
4ae72af4b5
commit
2cb53411c0
2 changed files with 13 additions and 0 deletions
|
@ -71,6 +71,7 @@ def pkgbase_disown_instance(request: Request, pkgbase: PackageBase) -> None:
|
||||||
notifs += handle_request(request, ORPHAN_ID, pkgbase)
|
notifs += handle_request(request, ORPHAN_ID, pkgbase)
|
||||||
with db.begin():
|
with db.begin():
|
||||||
pkgbase.Maintainer = None
|
pkgbase.Maintainer = None
|
||||||
|
db.delete_all(pkgbase.comaintainers)
|
||||||
|
|
||||||
util.apply_all(notifs, lambda n: n.send())
|
util.apply_all(notifs, lambda n: n.send())
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ from fastapi.testclient import TestClient
|
||||||
from aurweb import asgi, config, db, defaults, time
|
from aurweb import asgi, config, db, defaults, time
|
||||||
from aurweb.models import Package, PackageBase, PackageRequest, User
|
from aurweb.models import Package, PackageBase, PackageRequest, User
|
||||||
from aurweb.models.account_type import TRUSTED_USER_ID, USER_ID
|
from aurweb.models.account_type import TRUSTED_USER_ID, USER_ID
|
||||||
|
from aurweb.models.package_comaintainer import PackageComaintainer
|
||||||
from aurweb.models.package_notification import PackageNotification
|
from aurweb.models.package_notification import PackageNotification
|
||||||
from aurweb.models.package_request import ACCEPTED_ID, PENDING_ID, REJECTED_ID
|
from aurweb.models.package_request import ACCEPTED_ID, PENDING_ID, REJECTED_ID
|
||||||
from aurweb.models.request_type import DELETION_ID, MERGE_ID, ORPHAN_ID
|
from aurweb.models.request_type import DELETION_ID, MERGE_ID, ORPHAN_ID
|
||||||
|
@ -501,6 +502,11 @@ def test_merge_autorequest(client: TestClient, user: User, tu_user: User,
|
||||||
def test_orphan_request(client: TestClient, user: User, tu_user: User,
|
def test_orphan_request(client: TestClient, user: User, tu_user: User,
|
||||||
pkgbase: PackageBase, pkgreq: PackageRequest):
|
pkgbase: PackageBase, pkgreq: PackageRequest):
|
||||||
""" Test the standard orphan request route. """
|
""" Test the standard orphan request route. """
|
||||||
|
user2 = create_user("user2", "user2@example.org")
|
||||||
|
with db.begin():
|
||||||
|
db.create(PackageComaintainer, User=user2,
|
||||||
|
PackageBase=pkgbase, Priority=1)
|
||||||
|
|
||||||
idle_time = config.getint("options", "request_idle_time")
|
idle_time = config.getint("options", "request_idle_time")
|
||||||
now = time.utcnow()
|
now = time.utcnow()
|
||||||
with db.begin():
|
with db.begin():
|
||||||
|
@ -516,6 +522,12 @@ def test_orphan_request(client: TestClient, user: User, tu_user: User,
|
||||||
assert resp.status_code == int(HTTPStatus.SEE_OTHER)
|
assert resp.status_code == int(HTTPStatus.SEE_OTHER)
|
||||||
assert resp.headers.get("location") == f"/pkgbase/{pkgbase.Name}"
|
assert resp.headers.get("location") == f"/pkgbase/{pkgbase.Name}"
|
||||||
|
|
||||||
|
# We should have unset the maintainer.
|
||||||
|
assert pkgbase.Maintainer is None
|
||||||
|
|
||||||
|
# We should have removed the comaintainers.
|
||||||
|
assert not pkgbase.comaintainers.all()
|
||||||
|
|
||||||
# Ensure that `pkgreq`.ClosureComment was left alone when specified.
|
# Ensure that `pkgreq`.ClosureComment was left alone when specified.
|
||||||
assert pkgreq.ClosureComment == comments
|
assert pkgreq.ClosureComment == comments
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue