Verified Commit 2cb53411 authored by Kevin Morris's avatar Kevin Morris
Browse files

change: remove comaintainers when fulfilling orphan request



Closes FS#50079

Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
parent 4ae72af4
Pipeline #15729 passed with stages
in 4 minutes and 27 seconds
......@@ -71,6 +71,7 @@ def pkgbase_disown_instance(request: Request, pkgbase: PackageBase) -> None:
notifs += handle_request(request, ORPHAN_ID, pkgbase)
with db.begin():
pkgbase.Maintainer = None
db.delete_all(pkgbase.comaintainers)
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.models import Package, PackageBase, PackageRequest, User
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_request import ACCEPTED_ID, PENDING_ID, REJECTED_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,
pkgbase: PackageBase, pkgreq: PackageRequest):
""" 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")
now = time.utcnow()
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.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.
assert pkgreq.ClosureComment == comments
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment