mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: Fixtures weren't as deep in the directory structure as possible
Solution: Moved them down a level
This commit is contained in:
parent
a0fe965639
commit
7f23658cca
@ -7,6 +7,34 @@ import pytest
|
||||
from bigchaindb.upsert_validator import ValidatorElection
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def b_mock(b, network_validators):
|
||||
b.get_validators = mock_get_validators(network_validators)
|
||||
|
||||
return b
|
||||
|
||||
|
||||
def mock_get_validators(network_validators):
|
||||
def validator_set(height):
|
||||
validators = []
|
||||
for public_key, power in network_validators.items():
|
||||
validators.append({
|
||||
'pub_key': {'type': 'AC26791624DE60', 'data': public_key},
|
||||
'voting_power': power
|
||||
})
|
||||
return validators
|
||||
|
||||
return validator_set
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def valid_election(b_mock, node_key, new_validator):
|
||||
voters = ValidatorElection.recipients(b_mock)
|
||||
return ValidatorElection.generate([node_key.public_key],
|
||||
voters,
|
||||
new_validator, None).sign([node_key.private_key])
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def valid_election_b(b, node_key, new_validator):
|
||||
voters = ValidatorElection.recipients(b)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user