From 406a6374a6ecdcd8660a64b508a5d0476310ff6d Mon Sep 17 00:00:00 2001 From: Vanshdeep Singh Date: Wed, 1 Aug 2018 15:07:51 +0200 Subject: [PATCH] Problem: Delegated vote not casted back to election Solution: Update test to cast votes back to election id and assert their validity --- .../test_validator_election_vote.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/upsert_validator/test_validator_election_vote.py b/tests/upsert_validator/test_validator_election_vote.py index 99128cf6..78b2d528 100644 --- a/tests/upsert_validator/test_validator_election_vote.py +++ b/tests/upsert_validator/test_validator_election_vote.py @@ -40,8 +40,26 @@ def test_upsert_validator_delegate_election_vote(b_mock, valid_election, ed25519 [([alice.public_key], 3), ([key0.public_key], votes-3)], election_id=valid_election.id)\ .sign([key0.private_key]) + assert delegate_vote.validate(b_mock) + b_mock.store_bulk_transactions([delegate_vote]) + election_pub_key = ValidatorElectionVote.to_public_key(valid_election.id) + + alice_votes = delegate_vote.to_inputs()[0] + alice_casted_vote = ValidatorElectionVote.generate([alice_votes], + [([election_pub_key], 3)], + election_id=valid_election.id)\ + .sign([alice.private_key]) + assert alice_casted_vote.validate(b_mock) + + key0_votes = delegate_vote.to_inputs()[1] + key0_casted_vote = ValidatorElectionVote.generate([key0_votes], + [([election_pub_key], votes-3)], + election_id=valid_election.id)\ + .sign([key0.private_key]) + assert key0_casted_vote.validate(b_mock) + def test_upsert_validator_invalid_election_vote(b_mock, valid_election, ed25519_node_keys): b_mock.store_bulk_transactions([valid_election])