Skip to content

Commit

Permalink
add vote summary check
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlyp committed Aug 31, 2020
1 parent 95ac9ef commit 3c7c6e0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion politeiawww/cmd/cmswww/testrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,11 +916,32 @@ func testDCCVote(admin user) error {
if err != nil {
return err
}
expectedApprovalVotes := uint64(1)
err = dccVote(*c3, dccToken, cmsplugin.DCCDisapprovalString)
if err != nil {
return err
}

expectedDisapprovalVotes := uint64(1)
// Check to see that the votes are properly cast in gitbe
fmt.Printf(" check DCC votes")
vs, err := dccVoteSummary(*c2, dccToken)
if err != nil {
return err
}
for _, result := range vs.Results {
if result.Option.Id == cmsplugin.DCCApprovalString &&
result.VotesReceived != expectedApprovalVotes {
return fmt.Errorf("unexpected amount of %v votes, got %v wanted %v",
cmsplugin.DCCApprovalString, result.VotesReceived,
expectedApprovalVotes)
}
if result.Option.Id == cmsplugin.DCCDisapprovalString &&
result.VotesReceived != expectedDisapprovalVotes {
return fmt.Errorf("unexpected amount of %v votes, got %v wanted %v",
cmsplugin.DCCDisapprovalString, result.VotesReceived,
expectedDisapprovalVotes)
}
}
/*
// Have the admin approve the DCC
// This can't be done in the test run because the vote needs to
Expand Down

0 comments on commit 3c7c6e0

Please sign in to comment.