Jürgen Eckel 0b0c954d34
331 refactor a certain module gets a specific driver type flask sync driver abci server async driver first we stick to the current tarantool driver (#337)
* created ABCI_RPC class to seperate RPC interaction from the other ABCI interactions
* renamed validation.py to validator.py
* simplified planetmint/__init__.py
* moved methods used by testing to tests/utils.py
* making planetmint/__init__.py lean
* moved ProcessGroup object to tests as it is only used there
* reintegrated disabled tests


Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
2023-02-27 16:48:31 +01:00

40 lines
1.5 KiB
Python

# Copyright © 2020 Interplanetary Database Association e.V.,
# Planetmint and IPDB software contributors.
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
import pytest
from unittest.mock import patch
from planetmint.backend import query
from transactions.types.elections.validator_election import ValidatorElection
@pytest.fixture
def valid_upsert_validator_election_b(b, node_key, new_validator):
voters = b.get_recipients_list()
return ValidatorElection.generate([node_key.public_key], voters, new_validator, None).sign([node_key.private_key])
@pytest.fixture
@patch("transactions.types.elections.election.uuid4", lambda: "mock_uuid4")
def fixed_seed_election(b_mock, node_key, new_validator):
voters = b_mock.get_recipients_list()
return ValidatorElection.generate([node_key.public_key], voters, new_validator, None).sign([node_key.private_key])
@pytest.fixture
def concluded_election(b, ongoing_validator_election, ed25519_node_keys):
query.store_election(b.models.connection, ongoing_validator_election.id, 2, is_concluded=True)
return ongoing_validator_election
@pytest.fixture
def inconclusive_election(b, ongoing_validator_election, new_validator):
validators = b.models.get_validators(height=1)
validators[0]["voting_power"] = 15
validator_update = {"validators": validators, "height": 2, "election_id": "some_other_election"}
query.store_validator_set(b.models.connection, validator_update)
return ongoing_validator_election