planetmint/tests/web/test_validators.py
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

27 lines
816 B
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
VALIDATORS_ENDPOINT = "/api/v1/validators/"
def test_get_validators_endpoint(b, client):
validator_set = [
{
"address": "F5426F0980E36E03044F74DD414248D29ABCBDB2",
"pub_key": {"data": "4E2685D9016126864733225BE00F005515200727FBAB1312FC78C8B76831255A", "type": "ed25519"},
"voting_power": 10,
}
]
b.models.store_validator_set(23, validator_set)
res = client.get(VALIDATORS_ENDPOINT)
assert is_validator(res.json[0])
assert res.status_code == 200
# Helper
def is_validator(v):
return ("pub_key" in v) and ("voting_power" in v)