mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
test: update tests to work with TUVote.Decision
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
a29701459c
commit
cf4ab696d0
2 changed files with 10 additions and 7 deletions
|
@ -11,7 +11,7 @@ from fastapi.testclient import TestClient
|
|||
|
||||
from aurweb import config, db, filters, time
|
||||
from aurweb.models.account_type import DEVELOPER_ID, TRUSTED_USER_ID, AccountType
|
||||
from aurweb.models.tu_vote import TUVote
|
||||
from aurweb.models.tu_vote import YES_ID, TUVote
|
||||
from aurweb.models.tu_voteinfo import TUVoteInfo
|
||||
from aurweb.models.user import User
|
||||
from aurweb.testing.requests import Request
|
||||
|
@ -173,7 +173,7 @@ def test_tu_empty_index(client, tu_user):
|
|||
assert len(tables) == 0
|
||||
|
||||
|
||||
def test_tu_index(client, tu_user):
|
||||
def test_tu_index(client: TestClient, tu_user: User):
|
||||
ts = time.utcnow()
|
||||
|
||||
# Create some test votes: (Agenda, Start, End).
|
||||
|
@ -197,7 +197,8 @@ def test_tu_index(client, tu_user):
|
|||
vote_record = vote_records[1]
|
||||
vote_record.Yes += 1
|
||||
vote_record.ActiveTUs += 1
|
||||
db.create(TUVote, VoteInfo=vote_record, User=tu_user)
|
||||
db.create(TUVote, VoteInfo=vote_record, User=tu_user,
|
||||
Decision=YES_ID)
|
||||
|
||||
cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
|
||||
with client as request:
|
||||
|
@ -462,8 +463,8 @@ def test_tu_index_last_votes(client: TestClient, tu_user: User, tu_user2: User,
|
|||
Submitter=tu_user)
|
||||
|
||||
# Create a vote on it from tu_user.
|
||||
db.create(TUVote, VoteInfo=voteinfo, User=tu_user)
|
||||
db.create(TUVote, VoteInfo=voteinfo, User=tu_user2)
|
||||
db.create(TUVote, VoteInfo=voteinfo, User=tu_user, Decision=YES_ID)
|
||||
db.create(TUVote, VoteInfo=voteinfo, User=tu_user2, Decision=YES_ID)
|
||||
|
||||
# Now, check that tu_user got populated in the .last-votes table.
|
||||
cookies = {"AURSID": tu_user.login(Request(), "testPassword")}
|
||||
|
@ -575,7 +576,7 @@ def test_tu_running_proposal(client: TestClient,
|
|||
|
||||
# Create a vote.
|
||||
with db.begin():
|
||||
db.create(TUVote, VoteInfo=voteinfo, User=tu_user)
|
||||
db.create(TUVote, VoteInfo=voteinfo, User=tu_user, Decision=YES_ID)
|
||||
voteinfo.ActiveTUs += 1
|
||||
voteinfo.Yes += 1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue