mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
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:
parent
7d14598c01
commit
7cad22d0c6
@ -10,7 +10,9 @@ required:
|
|||||||
- operation
|
- operation
|
||||||
- outputs
|
- outputs
|
||||||
properties:
|
properties:
|
||||||
operation: "VALIDATOR_ELECTION_VOTE"
|
operation:
|
||||||
|
type: string
|
||||||
|
value: "VALIDATOR_ELECTION_VOTE"
|
||||||
outputs:
|
outputs:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
|||||||
@ -34,6 +34,26 @@ def test_upsert_validator_valid_election_vote(b_mock, valid_election, ed25519_no
|
|||||||
assert vote.validate(b_mock)
|
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.tendermint
|
||||||
@pytest.mark.bdb
|
@pytest.mark.bdb
|
||||||
def test_upsert_validator_delegate_election_vote(b_mock, valid_election, ed25519_node_keys):
|
def test_upsert_validator_delegate_election_vote(b_mock, valid_election, ed25519_node_keys):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user