change(python): refactor & centralize comaintainer management

This commit centralizes comaintainer management with a few new
functions and uses them more appropriately within routes:

- aurweb.packages.util.latest_priority
- aurweb.packages.util.remove_comaintainer
- aurweb.packages.util.remove_comaintainers
- aurweb.packages.util.add_comaintainer
- aurweb.packages.util.add_comaintainers
- aurweb.packages.util.rotate_comaintainers

Closes #117

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-12-29 01:28:56 -08:00
parent 9d3e77bab1
commit fc229d755b
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 151 additions and 82 deletions

View file

@ -75,14 +75,19 @@ def client() -> TestClient:
yield TestClient(app=asgi.app)
def create_user(username: str) -> User:
with db.begin():
user = db.create(User, Username=username,
Email=f"{username}@example.org",
Passwd="testPassword",
AccountTypeID=USER_ID)
return user
@pytest.fixture
def user() -> User:
""" Yield a user. """
with db.begin():
user = db.create(User, Username="test",
Email="test@example.org",
Passwd="testPassword",
AccountTypeID=USER_ID)
user = create_user("test")
yield user