mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
Fixes lint issues (#176)
* Resolved lint issues * resolved other lint issues
This commit is contained in:
parent
bf5c65f65c
commit
ef8dbff7a5
@ -3,6 +3,7 @@
|
||||
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||
# Code is Apache-2.0 and docs are CC-BY-4.0
|
||||
|
||||
from itertools import repeat
|
||||
import logging
|
||||
from importlib import import_module
|
||||
|
||||
@ -51,10 +52,10 @@ def connect(host: str = None, port: int = None, login: str = None, password: str
|
||||
replicaset = _kwargs_parser(key="replicaset", kwargs=kwargs) or Config().get()['database']['replicaset']
|
||||
ssl = _kwargs_parser(key="ssl", kwargs=kwargs) or Config().get()['database']['ssl']
|
||||
login = login or Config().get()['database']['login'] if _kwargs_parser(key="login",
|
||||
kwargs=kwargs) is None else _kwargs_parser(
|
||||
kwargs=kwargs) is None else _kwargs_parser( # noqa: E501
|
||||
key="login", kwargs=kwargs)
|
||||
password = password or Config().get()['database']['password'] if _kwargs_parser(key="password",
|
||||
kwargs=kwargs) is None else _kwargs_parser(
|
||||
kwargs=kwargs) is None else _kwargs_parser( # noqa: E501
|
||||
key="password", kwargs=kwargs)
|
||||
ca_cert = _kwargs_parser(key="ca_cert", kwargs=kwargs) or Config().get()['database']['ca_cert']
|
||||
certfile = _kwargs_parser(key="certfile", kwargs=kwargs) or Config().get()['database']['certfile']
|
||||
|
||||
@ -47,7 +47,7 @@ class TarantoolDBConnection(Connection):
|
||||
except tarantool.error.NetworkError as network_err:
|
||||
logger.info("Host cant be reached")
|
||||
raise network_err
|
||||
except:
|
||||
except ConfigurationError:
|
||||
logger.info("Exception in _connect(): {}")
|
||||
raise ConfigurationError
|
||||
|
||||
@ -82,11 +82,11 @@ class TarantoolDBConnection(Connection):
|
||||
|
||||
def drop_database(self):
|
||||
db_config = Config().get()["database"]
|
||||
cmd_resp = self.run_command(command=self.drop_path, config=db_config)
|
||||
cmd_resp = self.run_command(command=self.drop_path, config=db_config) # noqa: F841
|
||||
|
||||
def init_database(self):
|
||||
db_config = Config().get()["database"]
|
||||
cmd_resp = self.run_command(command=self.init_path, config=db_config)
|
||||
cmd_resp = self.run_command(command=self.init_path, config=db_config) # noqa: F841
|
||||
|
||||
def run_command(self, command: str, config: dict):
|
||||
from subprocess import run
|
||||
|
||||
@ -61,7 +61,7 @@ def store_transactions(connection, signed_transactions: list):
|
||||
connection.space("transactions").insert(txtuples["transactions"]),
|
||||
only_data=False
|
||||
)
|
||||
except: # This is used for omitting duplicate error in database for test -> test_bigchain_api::test_double_inclusion
|
||||
except: # This is used for omitting duplicate error in database for test -> test_bigchain_api::test_double_inclusion # noqa: E501, E722
|
||||
continue
|
||||
for _in in txtuples["inputs"]:
|
||||
connection.run(
|
||||
@ -110,7 +110,7 @@ def store_metadatas(connection, metadata: list):
|
||||
for meta in metadata:
|
||||
connection.run(
|
||||
connection.space("meta_data").insert(
|
||||
(meta["id"], json.dumps(meta["data"] if not "metadata" in meta else meta["metadata"])))
|
||||
(meta["id"], json.dumps(meta["data"] if not "metadata" in meta else meta["metadata"]))) # noqa: E713
|
||||
)
|
||||
|
||||
|
||||
@ -147,8 +147,6 @@ def store_asset(connection, asset):
|
||||
except DatabaseError:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@register_query(TarantoolDBConnection)
|
||||
def store_assets(connection, assets: list):
|
||||
for asset in assets:
|
||||
@ -469,7 +467,7 @@ def store_election(connection, election_id: str, height: int, is_concluded: bool
|
||||
@register_query(TarantoolDBConnection)
|
||||
def store_elections(connection, elections: list):
|
||||
for election in elections:
|
||||
_election = connection.run(
|
||||
_election = connection.run( # noqa: F841
|
||||
connection.space("elections").insert((election["election_id"],
|
||||
election["height"],
|
||||
election["is_concluded"])),
|
||||
@ -517,7 +515,7 @@ def get_election(connection, election_id: str):
|
||||
|
||||
@register_query(TarantoolDBConnection)
|
||||
def get_asset_tokens_for_public_key(connection, asset_id: str,
|
||||
public_key: str): # FIXME Something can be wrong with this function ! (public_key) is not used
|
||||
public_key: str): # FIXME Something can be wrong with this function ! (public_key) is not used # noqa: E501
|
||||
# space = connection.space("keys")
|
||||
# _keys = space.select([public_key], index="keys_search")
|
||||
_transactions = connection.run(
|
||||
|
||||
@ -38,8 +38,8 @@ INDEX_COMMANDS = {
|
||||
"assets":
|
||||
{
|
||||
"txid_search": "assets:create_index('txid_search', {type='hash', parts={'tx_id'}})",
|
||||
"assetid_search": "assets:create_index('assetid_search', {type='tree',unique=false, parts={'asset_id', 'tx_id'}})",
|
||||
"only_asset_search": "assets:create_index('only_asset_search', {type='tree', unique=false, parts={'asset_id'}})",
|
||||
"assetid_search": "assets:create_index('assetid_search', {type='tree',unique=false, parts={'asset_id', 'tx_id'}})", # noqa: E501
|
||||
"only_asset_search": "assets:create_index('only_asset_search', {type='tree', unique=false, parts={'asset_id'}})", # noqa: E501
|
||||
"text_search": "assets:create_index('secondary', {unique=false,parts={1,'string'}})"
|
||||
},
|
||||
"blocks":
|
||||
@ -57,7 +57,7 @@ INDEX_COMMANDS = {
|
||||
{
|
||||
"id_search": "elections:create_index('id_search' , {type='hash', parts={'election_id'}})",
|
||||
"height_search": "elections:create_index('height_search' , {type='tree',unique=false, parts={'height'}})",
|
||||
"update_search": "elections:create_index('update_search', {type='tree', unique=false, parts={'election_id', 'height'}})"
|
||||
"update_search": "elections:create_index('update_search', {type='tree', unique=false, parts={'election_id', 'height'}})" # noqa: E501
|
||||
},
|
||||
"meta_data":
|
||||
{
|
||||
@ -77,12 +77,12 @@ INDEX_COMMANDS = {
|
||||
"transactions":
|
||||
{
|
||||
"id_search": "transactions:create_index('id_search' , {type = 'hash' , parts={'transaction_id'}})",
|
||||
"transaction_search": "transactions:create_index('transaction_search' , {type = 'tree',unique=false, parts={'operation', 'transaction_id'}})"
|
||||
"transaction_search": "transactions:create_index('transaction_search' , {type = 'tree',unique=false, parts={'operation', 'transaction_id'}})" # noqa: E501
|
||||
},
|
||||
"inputs":
|
||||
{
|
||||
"delete_search": "inputs:create_index('delete_search' , {type = 'hash', parts={'input_id'}})",
|
||||
"spent_search": "inputs:create_index('spent_search' , {type = 'tree', unique=false, parts={'fulfills_transaction_id', 'fulfills_output_index'}})",
|
||||
"spent_search": "inputs:create_index('spent_search' , {type = 'tree', unique=false, parts={'fulfills_transaction_id', 'fulfills_output_index'}})", # noqa: E501
|
||||
"id_search": "inputs:create_index('id_search', {type = 'tree', unique=false, parts = {'transaction_id'}})"
|
||||
},
|
||||
"outputs":
|
||||
@ -100,36 +100,36 @@ INDEX_COMMANDS = {
|
||||
"utxos":
|
||||
{
|
||||
"id_search": "utxos:create_index('id_search', {type='hash' , parts={'transaction_id', 'output_index'}})",
|
||||
"transaction_search": "utxos:create_index('transaction_search', {type='tree', unique=false, parts={'transaction_id'}})",
|
||||
"transaction_search": "utxos:create_index('transaction_search', {type='tree', unique=false, parts={'transaction_id'}})", # noqa: E501
|
||||
"index_Search": "utxos:create_index('index_search', {type='tree', unique=false, parts={'output_index'}})"
|
||||
}
|
||||
}
|
||||
|
||||
SCHEMA_COMMANDS = {
|
||||
"abci_chains":
|
||||
"abci_chains:format({{name='height' , type='integer'},{name='is_synched' , type='boolean'},{name='chain_id',type='string'}, {name='id', type='string'}})",
|
||||
"abci_chains:format({{name='height' , type='integer'},{name='is_synched' , type='boolean'},{name='chain_id',type='string'}, {name='id', type='string'}})", # noqa: E501
|
||||
"assets":
|
||||
"assets:format({{name='data' , type='string'}, {name='tx_id', type='string'}, {name='asset_id', type='string'}})",
|
||||
"assets:format({{name='data' , type='string'}, {name='tx_id', type='string'}, {name='asset_id', type='string'}})", # noqa: E501
|
||||
"blocks":
|
||||
"blocks:format{{name='app_hash',type='string'},{name='height' , type='integer'},{name='block_id' , type='string'}}",
|
||||
"blocks:format{{name='app_hash',type='string'},{name='height' , type='integer'},{name='block_id' , type='string'}}", # noqa: E501
|
||||
"blocks_tx": "blocks_tx:format{{name='transaction_id', type = 'string'}, {name = 'block_id', type = 'string'}}",
|
||||
"elections":
|
||||
"elections:format({{name='election_id' , type='string'},{name='height' , type='integer'}, {name='is_concluded' , type='boolean'}})",
|
||||
"meta_data": "meta_datas:format({{name='transaction_id' , type='string'}, {name='meta_data' , type='string'}})",
|
||||
"elections:format({{name='election_id' , type='string'},{name='height' , type='integer'}, {name='is_concluded' , type='boolean'}})", # noqa: E501
|
||||
"meta_data": "meta_datas:format({{name='transaction_id' , type='string'}, {name='meta_data' , type='string'}})", # noqa: E501
|
||||
"pre_commits":
|
||||
"pre_commits:format({{name='commit_id', type='string'}, {name='height',type='integer'}, {name='transactions',type=any}})",
|
||||
"pre_commits:format({{name='commit_id', type='string'}, {name='height',type='integer'}, {name='transactions',type=any}})", # noqa: E501
|
||||
"validators":
|
||||
"validators:format({{name='validator_id' , type='string'},{name='height',type='integer'},{name='validators' , type='any'}})",
|
||||
"validators:format({{name='validator_id' , type='string'},{name='height',type='integer'},{name='validators' , type='any'}})", # noqa: E501
|
||||
"transactions":
|
||||
"transactions:format({{name='transaction_id' , type='string'}, {name='operation' , type='string'}, {name='version' ,type='string'}, {name='dict_map', type='any'}})",
|
||||
"transactions:format({{name='transaction_id' , type='string'}, {name='operation' , type='string'}, {name='version' ,type='string'}, {name='dict_map', type='any'}})", # noqa: E501
|
||||
"inputs":
|
||||
"inputs:format({{name='transaction_id' , type='string'}, {name='fulfillment' , type='any'}, {name='owners_before' , type='array'}, {name='fulfills_transaction_id', type = 'string'}, {name='fulfills_output_index', type = 'string'}, {name='input_id', type='string'}, {name='input_index', type='number'}})",
|
||||
"inputs:format({{name='transaction_id' , type='string'}, {name='fulfillment' , type='any'}, {name='owners_before' , type='array'}, {name='fulfills_transaction_id', type = 'string'}, {name='fulfills_output_index', type = 'string'}, {name='input_id', type='string'}, {name='input_index', type='number'}})", # noqa: E501
|
||||
"outputs":
|
||||
"outputs:format({{name='transaction_id' , type='string'}, {name='amount' , type='string'}, {name='uri', type='string'}, {name='details_type', type='string'}, {name='details_public_key', type='any'}, {name = 'output_id', type = 'string'}, {name='treshold', type='any'}, {name='subconditions', type='any'}, {name='output_index', type='number'}})",
|
||||
"outputs:format({{name='transaction_id' , type='string'}, {name='amount' , type='string'}, {name='uri', type='string'}, {name='details_type', type='string'}, {name='details_public_key', type='any'}, {name = 'output_id', type = 'string'}, {name='treshold', type='any'}, {name='subconditions', type='any'}, {name='output_index', type='number'}})", # noqa: E501
|
||||
"keys":
|
||||
"keys:format({{name = 'id', type='string'}, {name = 'transaction_id', type = 'string'} ,{name = 'output_id', type = 'string'}, {name = 'public_key', type = 'string'}, {name = 'key_index', type = 'integer'}})",
|
||||
"keys:format({{name = 'id', type='string'}, {name = 'transaction_id', type = 'string'} ,{name = 'output_id', type = 'string'}, {name = 'public_key', type = 'string'}, {name = 'key_index', type = 'integer'}})", # noqa: E501
|
||||
"utxos":
|
||||
"utxos:format({{name='transaction_id' , type='string'}, {name='output_index' , type='integer'}, {name='utxo_dict', type='string'}})"
|
||||
"utxos:format({{name='transaction_id' , type='string'}, {name='output_index' , type='integer'}, {name='utxo_dict', type='string'}})" # noqa: E501
|
||||
}
|
||||
|
||||
SCHEMA_DROP_COMMANDS = {
|
||||
|
||||
@ -245,7 +245,6 @@ def run_election_show(args, planet):
|
||||
|
||||
|
||||
def _run_init():
|
||||
from planetmint.backend import schema
|
||||
bdb = planetmint.Planetmint()
|
||||
schema.init_database(connection=bdb.connection)
|
||||
|
||||
@ -266,7 +265,6 @@ def run_drop(args):
|
||||
return
|
||||
|
||||
from planetmint.backend.connection import connect
|
||||
from planetmint.backend import schema
|
||||
conn = connect()
|
||||
try:
|
||||
schema.drop_database(conn)
|
||||
|
||||
@ -11,9 +11,6 @@ from logging.config import dictConfig as set_logging_config
|
||||
from planetmint.config import Config, DEFAULT_LOGGING_CONFIG
|
||||
import os
|
||||
|
||||
|
||||
|
||||
|
||||
def _normalize_log_level(level):
|
||||
try:
|
||||
return level.upper()
|
||||
|
||||
@ -741,13 +741,13 @@ class Transaction(object):
|
||||
id = tx['id']
|
||||
except KeyError:
|
||||
id = None
|
||||
# tx['asset'] = tx['asset'][0] if isinstance( tx['asset'], list) or isinstance( tx['asset'], tuple) else tx['asset'],
|
||||
# tx['asset'] = tx['asset'][0] if isinstance( tx['asset'], list) or isinstance( tx['asset'], tuple) else tx['asset'], # noqa: E501
|
||||
local_dict = {
|
||||
'inputs': tx['inputs'],
|
||||
'outputs': tx['outputs'],
|
||||
'operation': operation,
|
||||
'metadata': tx['metadata'],
|
||||
'asset': tx['asset'], # [0] if isinstance( tx['asset'], list) or isinstance( tx['asset'], tuple) else tx['asset'],
|
||||
'asset': tx['asset'], # [0] if isinstance( tx['asset'], list) or isinstance( tx['asset'], tuple) else tx['asset'], # noqa: E501
|
||||
'version': tx['version'],
|
||||
'id': id
|
||||
}
|
||||
|
||||
@ -109,4 +109,3 @@
|
||||
# password='secret')
|
||||
# conn.connect()
|
||||
# assert mock_authenticate.call_count == 1
|
||||
#
|
||||
@ -74,4 +74,3 @@
|
||||
# assert dummy_db in conn.conn.list_database_names()
|
||||
# schema.drop_database(conn, dummy_db)
|
||||
# assert dummy_db not in conn.conn.list_database_names()
|
||||
#
|
||||
@ -12,7 +12,7 @@ def _check_spaces_by_list(conn, space_names):
|
||||
try:
|
||||
conn.get_space(name)
|
||||
_exists.append(name)
|
||||
except:
|
||||
except: # noqa
|
||||
pass
|
||||
return _exists
|
||||
|
||||
@ -27,4 +27,3 @@ def test_drop(db_conn): # remove dummy_db as argument
|
||||
db_conn.drop_database()
|
||||
actual_spaces = _check_spaces_by_list(conn=db_conn, space_names=db_conn.SPACE_NAMES)
|
||||
assert [] == actual_spaces
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ from planetmint.transactions.common.exceptions import DatabaseDoesNotExist
|
||||
from planetmint.lib import Block
|
||||
from tests.utils import gen_vote
|
||||
from planetmint.config import Config
|
||||
from planetmint.upsert_validator import ValidatorElection
|
||||
from planetmint.upsert_validator import ValidatorElection # noqa
|
||||
|
||||
from tendermint.abci import types_pb2 as types
|
||||
from tendermint.crypto import keys_pb2
|
||||
@ -97,7 +97,7 @@ def _bdb_marker(request):
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _restore_config(_configure_planetmint):
|
||||
config_before_test = Config().init_config('tarantool_db')
|
||||
config_before_test = Config().init_config('tarantool_db') # noqa
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
@ -123,7 +123,6 @@ def _configure_planetmint(request):
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def _setup_database(_configure_planetmint): # TODO Here is located setup database
|
||||
from planetmint.backend.connection import connect
|
||||
from planetmint.config import Config
|
||||
|
||||
print('Initializing test db')
|
||||
@ -145,8 +144,6 @@ def _setup_database(_configure_planetmint): # TODO Here is located setup databa
|
||||
|
||||
@pytest.fixture
|
||||
def _bdb(_setup_database, _configure_planetmint):
|
||||
print(f"BDB CALL")
|
||||
from planetmint.backend import connect
|
||||
from planetmint.transactions.common.memoize import to_dict, from_dict
|
||||
from planetmint.models import Transaction
|
||||
from .utils import flush_db
|
||||
@ -392,7 +389,6 @@ def db_name(db_config):
|
||||
|
||||
@pytest.fixture
|
||||
def db_conn():
|
||||
from planetmint.backend import connect
|
||||
return connect()
|
||||
|
||||
|
||||
@ -502,7 +498,7 @@ def unspent_output_0():
|
||||
'amount': 1,
|
||||
'asset_id': 'e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d',
|
||||
'condition_uri': 'ni:///sha-256;RmovleG60-7K0CX60jjfUunV3lBpUOkiQOAnBzghm0w?fpt=ed25519-sha-256&cost=131072',
|
||||
'fulfillment_message': '{"asset":{"data":{"hash":"06e47bcf9084f7ecfd2a2a2ad275444a"}},"id":"e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d","inputs":[{"fulfillment":"pGSAIIQT0Jm6LDlcSs9coJK4Q4W-SNtsO2EtMtQJ04EUjBMJgUAXKIqeaippbF-IClhhZNNaP6EIZ_OgrVQYU4mH6b-Vc3Tg-k6p-rJOlLGUUo_w8C5QgPHNRYFOqUk2f1q0Cs4G","fulfills":null,"owners_before":["9taLkHkaBXeSF8vrhDGFTAmcZuCEPqjQrKadfYGs4gHv"]}],"metadata":null,"operation":"CREATE","outputs":[{"amount":"1","condition":{"details":{"public_key":"6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz","type":"ed25519-sha-256"},"uri":"ni:///sha-256;RmovleG60-7K0CX60jjfUunV3lBpUOkiQOAnBzghm0w?fpt=ed25519-sha-256&cost=131072"},"public_keys":["6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz"]},{"amount":"2","condition":{"details":{"public_key":"AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT","type":"ed25519-sha-256"},"uri":"ni:///sha-256;-HlYmgwwl-vXwE52IaADhvYxaL1TbjqfJ-LGn5a1PFc?fpt=ed25519-sha-256&cost=131072"},"public_keys":["AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT"]},{"amount":"3","condition":{"details":{"public_key":"HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB","type":"ed25519-sha-256"},"uri":"ni:///sha-256;xfn8pvQkTCPtvR0trpHy2pqkkNTmMBCjWMMOHtk3WO4?fpt=ed25519-sha-256&cost=131072"},"public_keys":["HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB"]}],"version":"1.0"}',
|
||||
'fulfillment_message': '{"asset":{"data":{"hash":"06e47bcf9084f7ecfd2a2a2ad275444a"}},"id":"e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d","inputs":[{"fulfillment":"pGSAIIQT0Jm6LDlcSs9coJK4Q4W-SNtsO2EtMtQJ04EUjBMJgUAXKIqeaippbF-IClhhZNNaP6EIZ_OgrVQYU4mH6b-Vc3Tg-k6p-rJOlLGUUo_w8C5QgPHNRYFOqUk2f1q0Cs4G","fulfills":null,"owners_before":["9taLkHkaBXeSF8vrhDGFTAmcZuCEPqjQrKadfYGs4gHv"]}],"metadata":null,"operation":"CREATE","outputs":[{"amount":"1","condition":{"details":{"public_key":"6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz","type":"ed25519-sha-256"},"uri":"ni:///sha-256;RmovleG60-7K0CX60jjfUunV3lBpUOkiQOAnBzghm0w?fpt=ed25519-sha-256&cost=131072"},"public_keys":["6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz"]},{"amount":"2","condition":{"details":{"public_key":"AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT","type":"ed25519-sha-256"},"uri":"ni:///sha-256;-HlYmgwwl-vXwE52IaADhvYxaL1TbjqfJ-LGn5a1PFc?fpt=ed25519-sha-256&cost=131072"},"public_keys":["AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT"]},{"amount":"3","condition":{"details":{"public_key":"HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB","type":"ed25519-sha-256"},"uri":"ni:///sha-256;xfn8pvQkTCPtvR0trpHy2pqkkNTmMBCjWMMOHtk3WO4?fpt=ed25519-sha-256&cost=131072"},"public_keys":["HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB"]}],"version":"1.0"}', # noqa: E501
|
||||
# noqa
|
||||
'output_index': 0,
|
||||
'transaction_id': 'e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d'
|
||||
@ -515,7 +511,7 @@ def unspent_output_1():
|
||||
'amount': 2,
|
||||
'asset_id': 'e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d',
|
||||
'condition_uri': 'ni:///sha-256;-HlYmgwwl-vXwE52IaADhvYxaL1TbjqfJ-LGn5a1PFc?fpt=ed25519-sha-256&cost=131072',
|
||||
'fulfillment_message': '{"asset":{"data":{"hash":"06e47bcf9084f7ecfd2a2a2ad275444a"}},"id":"e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d","inputs":[{"fulfillment":"pGSAIIQT0Jm6LDlcSs9coJK4Q4W-SNtsO2EtMtQJ04EUjBMJgUAXKIqeaippbF-IClhhZNNaP6EIZ_OgrVQYU4mH6b-Vc3Tg-k6p-rJOlLGUUo_w8C5QgPHNRYFOqUk2f1q0Cs4G","fulfills":null,"owners_before":["9taLkHkaBXeSF8vrhDGFTAmcZuCEPqjQrKadfYGs4gHv"]}],"metadata":null,"operation":"CREATE","outputs":[{"amount":"1","condition":{"details":{"public_key":"6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz","type":"ed25519-sha-256"},"uri":"ni:///sha-256;RmovleG60-7K0CX60jjfUunV3lBpUOkiQOAnBzghm0w?fpt=ed25519-sha-256&cost=131072"},"public_keys":["6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz"]},{"amount":"2","condition":{"details":{"public_key":"AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT","type":"ed25519-sha-256"},"uri":"ni:///sha-256;-HlYmgwwl-vXwE52IaADhvYxaL1TbjqfJ-LGn5a1PFc?fpt=ed25519-sha-256&cost=131072"},"public_keys":["AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT"]},{"amount":"3","condition":{"details":{"public_key":"HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB","type":"ed25519-sha-256"},"uri":"ni:///sha-256;xfn8pvQkTCPtvR0trpHy2pqkkNTmMBCjWMMOHtk3WO4?fpt=ed25519-sha-256&cost=131072"},"public_keys":["HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB"]}],"version":"1.0"}',
|
||||
'fulfillment_message': '{"asset":{"data":{"hash":"06e47bcf9084f7ecfd2a2a2ad275444a"}},"id":"e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d","inputs":[{"fulfillment":"pGSAIIQT0Jm6LDlcSs9coJK4Q4W-SNtsO2EtMtQJ04EUjBMJgUAXKIqeaippbF-IClhhZNNaP6EIZ_OgrVQYU4mH6b-Vc3Tg-k6p-rJOlLGUUo_w8C5QgPHNRYFOqUk2f1q0Cs4G","fulfills":null,"owners_before":["9taLkHkaBXeSF8vrhDGFTAmcZuCEPqjQrKadfYGs4gHv"]}],"metadata":null,"operation":"CREATE","outputs":[{"amount":"1","condition":{"details":{"public_key":"6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz","type":"ed25519-sha-256"},"uri":"ni:///sha-256;RmovleG60-7K0CX60jjfUunV3lBpUOkiQOAnBzghm0w?fpt=ed25519-sha-256&cost=131072"},"public_keys":["6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz"]},{"amount":"2","condition":{"details":{"public_key":"AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT","type":"ed25519-sha-256"},"uri":"ni:///sha-256;-HlYmgwwl-vXwE52IaADhvYxaL1TbjqfJ-LGn5a1PFc?fpt=ed25519-sha-256&cost=131072"},"public_keys":["AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT"]},{"amount":"3","condition":{"details":{"public_key":"HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB","type":"ed25519-sha-256"},"uri":"ni:///sha-256;xfn8pvQkTCPtvR0trpHy2pqkkNTmMBCjWMMOHtk3WO4?fpt=ed25519-sha-256&cost=131072"},"public_keys":["HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB"]}],"version":"1.0"}', # noqa: E501
|
||||
# noqa
|
||||
'output_index': 1,
|
||||
'transaction_id': 'e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d',
|
||||
@ -528,7 +524,7 @@ def unspent_output_2():
|
||||
'amount': 3,
|
||||
'asset_id': 'e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d',
|
||||
'condition_uri': 'ni:///sha-256;xfn8pvQkTCPtvR0trpHy2pqkkNTmMBCjWMMOHtk3WO4?fpt=ed25519-sha-256&cost=131072',
|
||||
'fulfillment_message': '{"asset":{"data":{"hash":"06e47bcf9084f7ecfd2a2a2ad275444a"}},"id":"e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d","inputs":[{"fulfillment":"pGSAIIQT0Jm6LDlcSs9coJK4Q4W-SNtsO2EtMtQJ04EUjBMJgUAXKIqeaippbF-IClhhZNNaP6EIZ_OgrVQYU4mH6b-Vc3Tg-k6p-rJOlLGUUo_w8C5QgPHNRYFOqUk2f1q0Cs4G","fulfills":null,"owners_before":["9taLkHkaBXeSF8vrhDGFTAmcZuCEPqjQrKadfYGs4gHv"]}],"metadata":null,"operation":"CREATE","outputs":[{"amount":"1","condition":{"details":{"public_key":"6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz","type":"ed25519-sha-256"},"uri":"ni:///sha-256;RmovleG60-7K0CX60jjfUunV3lBpUOkiQOAnBzghm0w?fpt=ed25519-sha-256&cost=131072"},"public_keys":["6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz"]},{"amount":"2","condition":{"details":{"public_key":"AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT","type":"ed25519-sha-256"},"uri":"ni:///sha-256;-HlYmgwwl-vXwE52IaADhvYxaL1TbjqfJ-LGn5a1PFc?fpt=ed25519-sha-256&cost=131072"},"public_keys":["AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT"]},{"amount":"3","condition":{"details":{"public_key":"HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB","type":"ed25519-sha-256"},"uri":"ni:///sha-256;xfn8pvQkTCPtvR0trpHy2pqkkNTmMBCjWMMOHtk3WO4?fpt=ed25519-sha-256&cost=131072"},"public_keys":["HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB"]}],"version":"1.0"}',
|
||||
'fulfillment_message': '{"asset":{"data":{"hash":"06e47bcf9084f7ecfd2a2a2ad275444a"}},"id":"e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d","inputs":[{"fulfillment":"pGSAIIQT0Jm6LDlcSs9coJK4Q4W-SNtsO2EtMtQJ04EUjBMJgUAXKIqeaippbF-IClhhZNNaP6EIZ_OgrVQYU4mH6b-Vc3Tg-k6p-rJOlLGUUo_w8C5QgPHNRYFOqUk2f1q0Cs4G","fulfills":null,"owners_before":["9taLkHkaBXeSF8vrhDGFTAmcZuCEPqjQrKadfYGs4gHv"]}],"metadata":null,"operation":"CREATE","outputs":[{"amount":"1","condition":{"details":{"public_key":"6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz","type":"ed25519-sha-256"},"uri":"ni:///sha-256;RmovleG60-7K0CX60jjfUunV3lBpUOkiQOAnBzghm0w?fpt=ed25519-sha-256&cost=131072"},"public_keys":["6FDGsHrR9RZqNaEm7kBvqtxRkrvuWogBW2Uy7BkWc5Tz"]},{"amount":"2","condition":{"details":{"public_key":"AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT","type":"ed25519-sha-256"},"uri":"ni:///sha-256;-HlYmgwwl-vXwE52IaADhvYxaL1TbjqfJ-LGn5a1PFc?fpt=ed25519-sha-256&cost=131072"},"public_keys":["AH9D7xgmhyLmVE944zvHvuvYWuj5DfbMBJhnDM4A5FdT"]},{"amount":"3","condition":{"details":{"public_key":"HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB","type":"ed25519-sha-256"},"uri":"ni:///sha-256;xfn8pvQkTCPtvR0trpHy2pqkkNTmMBCjWMMOHtk3WO4?fpt=ed25519-sha-256&cost=131072"},"public_keys":["HpmSVrojHvfCXQbmoAs4v6Aq1oZiZsZDnjr68KiVtPbB"]}],"version":"1.0"}', # noqa: E501
|
||||
# noqa
|
||||
'output_index': 2,
|
||||
'transaction_id': 'e897c7a0426461a02b4fca8ed73bc0debed7570cf3b40fb4f49c963434225a4d',
|
||||
|
||||
@ -289,7 +289,7 @@ def test_store_bulk_transaction(mocker, b, signed_create_tx,
|
||||
def test_delete_zero_unspent_outputs(b, utxoset):
|
||||
unspent_outputs, utxo_collection = utxoset
|
||||
num_rows_before_operation = utxo_collection.select().rowcount
|
||||
delete_res = b.delete_unspent_outputs()
|
||||
delete_res = b.delete_unspent_outputs() # noqa: F841
|
||||
num_rows_after_operation = utxo_collection.select().rowcount
|
||||
# assert delete_res is None
|
||||
assert num_rows_before_operation == num_rows_after_operation
|
||||
|
||||
@ -179,7 +179,6 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch,
|
||||
'PLANETMINT_DATABASE_KEYFILE_PASSPHRASE': 'passphrase',
|
||||
})
|
||||
|
||||
import planetmint
|
||||
from planetmint import config_utils
|
||||
from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config
|
||||
config_utils.autoconfigure()
|
||||
@ -270,7 +269,6 @@ def test_autoconfigure_explicit_file(monkeypatch):
|
||||
|
||||
|
||||
def test_update_config(monkeypatch):
|
||||
import planetmint
|
||||
from planetmint import config_utils
|
||||
|
||||
file_config = {
|
||||
@ -320,7 +318,6 @@ def test_write_config():
|
||||
('PLANETMINT_DATABASE_NAME', 'test-db', 'name'),
|
||||
))
|
||||
def test_database_envs(env_name, env_value, config_key, monkeypatch):
|
||||
import planetmint
|
||||
|
||||
monkeypatch.setattr('os.environ', {env_name: env_value})
|
||||
planetmint.config_utils.autoconfigure()
|
||||
|
||||
@ -44,4 +44,3 @@ def inconclusive_election(b, ongoing_validator_election, new_validator):
|
||||
|
||||
query.store_validator_set(b.connection, validator_update)
|
||||
return ongoing_validator_election
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user