mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(FastAPI): use popupdate when [un]voting
The `aurweb.scripts.popupdate` script is used to maintain the NumVotes and Popularity field. We could do the NumVotes change more simply; however, since this is already a long-term implementation, we're going to use it until we move scripts over to ORM. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
01fb42c5d9
commit
63498f5edd
3 changed files with 47 additions and 10 deletions
|
@ -1771,6 +1771,7 @@ def test_pkgbase_vote(client: TestClient, user: User, package: Package):
|
|||
|
||||
vote = pkgbase.package_votes.filter(PackageVote.UsersID == user.ID).first()
|
||||
assert vote is not None
|
||||
assert pkgbase.NumVotes == 1
|
||||
|
||||
# Remove vote.
|
||||
endpoint = f"/pkgbase/{pkgbase.Name}/unvote"
|
||||
|
@ -1780,6 +1781,7 @@ def test_pkgbase_vote(client: TestClient, user: User, package: Package):
|
|||
|
||||
vote = pkgbase.package_votes.filter(PackageVote.UsersID == user.ID).first()
|
||||
assert vote is None
|
||||
assert pkgbase.NumVotes == 0
|
||||
|
||||
|
||||
def test_pkgbase_disown_as_tu(client: TestClient, tu_user: User,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue