Problem: No test to check invalid crypto-conditions

Solution: Add test which raises validation error when using unsupported cypto-conditions
This commit is contained in:
Vanshdeep Singh 2018-08-20 11:02:19 +02:00
parent 7d14598c01
commit 7cad22d0c6
2 changed files with 23 additions and 1 deletions

View File

@ -10,7 +10,9 @@ required:
- operation
- outputs
properties:
operation: "VALIDATOR_ELECTION_VOTE"
operation:
type: string
value: "VALIDATOR_ELECTION_VOTE"
outputs:
type: array
items:

View File

@ -34,6 +34,26 @@ def test_upsert_validator_valid_election_vote(b_mock, valid_election, ed25519_no
assert vote.validate(b_mock)
@pytest.mark.tendermint
@pytest.mark.bdb
def test_upsert_validator_valid_non_election_vote(b_mock, valid_election, ed25519_node_keys):
b_mock.store_bulk_transactions([valid_election])
input0 = valid_election.to_inputs()[0]
votes = valid_election.outputs[0].amount
public_key0 = input0.owners_before[0]
key0 = ed25519_node_keys[public_key0]
election_pub_key = ValidatorElection.to_public_key(valid_election.id)
# Ensure that threshold conditions are now allowed
with pytest.raises(ValidationError):
ValidatorElectionVote.generate([input0],
[([election_pub_key, key0.public_key], votes)],
election_id=valid_election.id)\
.sign([key0.private_key])
@pytest.mark.tendermint
@pytest.mark.bdb
def test_upsert_validator_delegate_election_vote(b_mock, valid_election, ed25519_node_keys):