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']
|
||||
|
||||
@ -41,7 +41,7 @@ class LocalMongoDBConnection(Connection):
|
||||
self.keyfile = keyfile or Config().get()['database']['keyfile']
|
||||
self.keyfile_passphrase = keyfile_passphrase or Config().get()['database']['keyfile_passphrase']
|
||||
self.crlfile = crlfile or Config().get()['database']['crlfile']
|
||||
if not self.ssl :
|
||||
if not self.ssl:
|
||||
self.ssl = False
|
||||
if not self.keyfile_passphrase:
|
||||
self.keyfile_passphrase = None
|
||||
|
||||
@ -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 = {
|
||||
@ -184,7 +184,7 @@ def run_command_with_output(command):
|
||||
@register_schema(TarantoolDBConnection)
|
||||
def create_tables(connection, dbname):
|
||||
for _space in SPACE_NAMES:
|
||||
try:
|
||||
try:
|
||||
cmd = SPACE_COMMANDS[_space].encode()
|
||||
run_command_with_output(command=cmd)
|
||||
print(f"Space '{_space}' created.")
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import copy
|
||||
import logging
|
||||
import os
|
||||
#from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config
|
||||
# from planetmint.log import DEFAULT_LOGGING_CONFIG as log_config
|
||||
from planetmint.version import __version__ # noqa
|
||||
|
||||
|
||||
|
||||
@ -193,7 +193,7 @@ def set_config(config):
|
||||
# Update the default config with whatever is in the passed config
|
||||
update(_config, update_types(config, _config))
|
||||
_config['CONFIGURED'] = True
|
||||
Config().set( _config )
|
||||
Config().set(_config)
|
||||
|
||||
|
||||
def update_config(config):
|
||||
@ -209,7 +209,7 @@ def update_config(config):
|
||||
# Update the default config with whatever is in the passed config
|
||||
update(_config, update_types(config, _config))
|
||||
_config['CONFIGURED'] = True
|
||||
Config().set( _config )
|
||||
Config().set(_config)
|
||||
|
||||
|
||||
def write_config(config, filename=None):
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -735,19 +735,19 @@ class Transaction(object):
|
||||
else Transaction.CREATE
|
||||
)
|
||||
cls = Transaction.resolve_class(operation)
|
||||
|
||||
|
||||
id = None
|
||||
try:
|
||||
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
|
||||
}
|
||||
|
||||
@ -1,42 +1,42 @@
|
||||
## 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
|
||||
# # 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
|
||||
#
|
||||
#from unittest import mock
|
||||
# from unittest import mock
|
||||
#
|
||||
#import pytest
|
||||
#import pymongo
|
||||
#from pymongo import MongoClient
|
||||
# import pytest
|
||||
# import pymongo
|
||||
# from pymongo import MongoClient
|
||||
#
|
||||
#
|
||||
#pytestmark = pytest.mark.bdb
|
||||
# pytestmark = pytest.mark.bdb
|
||||
#
|
||||
#
|
||||
#@pytest.fixture
|
||||
#def mock_cmd_line_opts():
|
||||
# @pytest.fixture
|
||||
# def mock_cmd_line_opts():
|
||||
# return {'argv': ['mongod', '--dbpath=/data'],
|
||||
# 'ok': 1.0,
|
||||
# 'parsed': {'replication': {'replSet': None},
|
||||
# 'storage': {'dbPath': '/data'}}}
|
||||
#
|
||||
#
|
||||
#@pytest.fixture
|
||||
#def mock_config_opts():
|
||||
# @pytest.fixture
|
||||
# def mock_config_opts():
|
||||
# return {'argv': ['mongod', '--dbpath=/data'],
|
||||
# 'ok': 1.0,
|
||||
# 'parsed': {'replication': {'replSetName': None},
|
||||
# 'storage': {'dbPath': '/data'}}}
|
||||
#
|
||||
#
|
||||
#@pytest.fixture
|
||||
#def mongodb_connection():
|
||||
# @pytest.fixture
|
||||
# def mongodb_connection():
|
||||
# import planetmint
|
||||
# return MongoClient(host=planetmint.config['database']['host'],
|
||||
# port=planetmint.config['database']['port'])
|
||||
#
|
||||
#
|
||||
#def test_get_connection_returns_the_correct_instance(db_host, db_port):
|
||||
# def test_get_connection_returns_the_correct_instance(db_host, db_port):
|
||||
# from planetmint.backend import connect
|
||||
# from planetmint.backend.connection import Connection
|
||||
# from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
@ -55,8 +55,8 @@
|
||||
# assert conn.conn._topology_settings.replica_set_name == config['replicaset']
|
||||
#
|
||||
#
|
||||
#@mock.patch('pymongo.MongoClient.__init__')
|
||||
#def test_connection_error(mock_client):
|
||||
# @mock.patch('pymongo.MongoClient.__init__')
|
||||
# def test_connection_error(mock_client):
|
||||
# from planetmint.backend import connect
|
||||
# from planetmint.backend.exceptions import ConnectionError
|
||||
#
|
||||
@ -72,7 +72,7 @@
|
||||
# assert mock_client.call_count == 3
|
||||
#
|
||||
#
|
||||
#def test_connection_run_errors():
|
||||
# def test_connection_run_errors():
|
||||
# from planetmint.backend import connect
|
||||
# from planetmint.backend.exceptions import (DuplicateKeyError,
|
||||
# OperationError,
|
||||
@ -99,8 +99,8 @@
|
||||
# assert query.run.call_count == 1
|
||||
#
|
||||
#
|
||||
#@mock.patch('pymongo.database.Database.authenticate')
|
||||
#def test_connection_with_credentials(mock_authenticate):
|
||||
# @mock.patch('pymongo.database.Database.authenticate')
|
||||
# def test_connection_with_credentials(mock_authenticate):
|
||||
# import planetmint
|
||||
# from planetmint.backend.localmongodb.connection import LocalMongoDBConnection
|
||||
# conn = LocalMongoDBConnection(host=planetmint.config['database']['host'],
|
||||
@ -109,4 +109,3 @@
|
||||
# password='secret')
|
||||
# conn.connect()
|
||||
# assert mock_authenticate.call_count == 1
|
||||
#
|
||||
@ -1,22 +1,22 @@
|
||||
## # 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
|
||||
# # # 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
|
||||
#
|
||||
#from copy import deepcopy
|
||||
#from planetmint.transactions.types.assets.create import Create
|
||||
#from planetmint.transactions.types.assets.transfer import Transfer
|
||||
# from copy import deepcopy
|
||||
# from planetmint.transactions.types.assets.create import Create
|
||||
# from planetmint.transactions.types.assets.transfer import Transfer
|
||||
#
|
||||
## import pytest
|
||||
## import pymongo
|
||||
# # import pytest
|
||||
# # import pymongo
|
||||
#
|
||||
## from planetmint.backend import Connection, query
|
||||
# # from planetmint.backend import Connection, query
|
||||
#
|
||||
#
|
||||
## pytestmark = pytest.mark.bdb
|
||||
# # pytestmark = pytest.mark.bdb
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_txids_filtered(signed_create_tx, signed_transfer_tx):
|
||||
# @pytest.mark.skip
|
||||
# def test_get_txids_filtered(signed_create_tx, signed_transfer_tx):
|
||||
# from planetmint.backend import connect, query
|
||||
# from planetmint.models import Transaction
|
||||
# conn = connect()
|
||||
@ -40,8 +40,8 @@
|
||||
# txids = set(query.get_txids_filtered(conn, asset_id, Transaction.TRANSFER))
|
||||
# assert txids == {signed_transfer_tx.id}
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_write_assets():
|
||||
# @pytest.mark.skip
|
||||
# def test_write_assets():
|
||||
# from planetmint.backend import connect, query
|
||||
# conn = connect()
|
||||
#
|
||||
@ -64,8 +64,8 @@
|
||||
# assert cursor.collection.count_documents({}) == 3
|
||||
# assert list(cursor) == assets[:-1]
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_assets():
|
||||
# @pytest.mark.skip
|
||||
# def test_get_assets():
|
||||
# from planetmint.backend import connect, query
|
||||
# conn = connect()
|
||||
#
|
||||
@ -80,9 +80,9 @@
|
||||
# for asset in assets:
|
||||
# assert query.get_asset(conn, asset['id'])
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#@pytest.mark.parametrize('table', ['assets', 'metadata'])
|
||||
#def test_text_search(table):
|
||||
# @pytest.mark.skip
|
||||
# @pytest.mark.parametrize('table', ['assets', 'metadata'])
|
||||
# def test_text_search(table):
|
||||
# from planetmint.backend import connect, query
|
||||
# conn = connect()
|
||||
#
|
||||
@ -165,8 +165,8 @@
|
||||
# {'id': 2, 'subject': 'Coffee Shopping', 'author': 'efg', 'views': 5},
|
||||
# ]
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_write_metadata():
|
||||
# @pytest.mark.skip
|
||||
# def test_write_metadata():
|
||||
# from planetmint.backend import connect, query
|
||||
# conn = connect()
|
||||
#
|
||||
@ -186,8 +186,8 @@
|
||||
# assert cursor.collection.count_documents({}) == 3
|
||||
# assert list(cursor) == metadata
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_metadata():
|
||||
# @pytest.mark.skip
|
||||
# def test_get_metadata():
|
||||
# from planetmint.backend import connect, query
|
||||
# conn = connect()
|
||||
#
|
||||
@ -202,8 +202,8 @@
|
||||
# for meta in metadata:
|
||||
# assert query.get_metadata(conn, [meta['id']])
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_owned_ids(signed_create_tx, user_pk):
|
||||
# @pytest.mark.skip
|
||||
# def test_get_owned_ids(signed_create_tx, user_pk):
|
||||
# from planetmint.backend import connect, query
|
||||
# conn = connect()
|
||||
#
|
||||
@ -214,8 +214,8 @@
|
||||
#
|
||||
# assert txns[0] == signed_create_tx.to_dict()
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_spending_transactions(user_pk, user_sk):
|
||||
# @pytest.mark.skip
|
||||
# def test_get_spending_transactions(user_pk, user_sk):
|
||||
# from planetmint.backend import connect, query
|
||||
# conn = connect()
|
||||
#
|
||||
@ -235,8 +235,8 @@
|
||||
# # tx3 not a member because input 1 not asked for
|
||||
# assert txns == [tx2.to_dict(), tx4.to_dict()]
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_spending_transactions_multiple_inputs():
|
||||
# @pytest.mark.skip
|
||||
# def test_get_spending_transactions_multiple_inputs():
|
||||
# from planetmint.backend import connect, query
|
||||
# from planetmint.transactions.common.crypto import generate_key_pair
|
||||
# conn = connect()
|
||||
@ -277,8 +277,8 @@
|
||||
# if len(txns):
|
||||
# assert [tx['id'] for tx in txns] == match
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_store_block():
|
||||
# @pytest.mark.skip
|
||||
# def test_store_block():
|
||||
# from planetmint.backend import connect, query
|
||||
# from planetmint.lib import Block
|
||||
# conn = connect()
|
||||
@ -290,8 +290,8 @@
|
||||
# cursor = conn.db.blocks.find({}, projection={'_id': False})
|
||||
# assert cursor.collection.count_documents({}) == 1
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_block():
|
||||
# @pytest.mark.skip
|
||||
# def test_get_block():
|
||||
# from planetmint.backend import connect, query
|
||||
# from planetmint.lib import Block
|
||||
# conn = connect()
|
||||
@ -305,8 +305,8 @@
|
||||
# block = dict(query.get_block(conn, 3))
|
||||
# assert block['height'] == 3
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_delete_zero_unspent_outputs(db_context, utxoset):
|
||||
# @pytest.mark.skip
|
||||
# def test_delete_zero_unspent_outputs(db_context, utxoset):
|
||||
# from planetmint.backend import query
|
||||
# unspent_outputs, utxo_collection = utxoset
|
||||
# delete_res = query.delete_unspent_outputs(db_context.conn)
|
||||
@ -320,8 +320,8 @@
|
||||
# ]}
|
||||
# ) == 3
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_delete_one_unspent_outputs(db_context, utxoset):
|
||||
# @pytest.mark.skip
|
||||
# def test_delete_one_unspent_outputs(db_context, utxoset):
|
||||
# from planetmint.backend import query
|
||||
# unspent_outputs, utxo_collection = utxoset
|
||||
# delete_res = query.delete_unspent_outputs(db_context.conn,
|
||||
@ -336,8 +336,8 @@
|
||||
# assert utxo_collection.count_documents(
|
||||
# {'transaction_id': 'a', 'output_index': 0}) == 0
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_delete_many_unspent_outputs(db_context, utxoset):
|
||||
# @pytest.mark.skip
|
||||
# def test_delete_many_unspent_outputs(db_context, utxoset):
|
||||
# from planetmint.backend import query
|
||||
# unspent_outputs, utxo_collection = utxoset
|
||||
# delete_res = query.delete_unspent_outputs(db_context.conn,
|
||||
@ -352,15 +352,15 @@
|
||||
# assert utxo_collection.count_documents(
|
||||
# {'transaction_id': 'a', 'output_index': 1}) == 1
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_store_zero_unspent_output(db_context, utxo_collection):
|
||||
# @pytest.mark.skip
|
||||
# def test_store_zero_unspent_output(db_context, utxo_collection):
|
||||
# from planetmint.backend import query
|
||||
# res = query.store_unspent_outputs(db_context.conn)
|
||||
# assert res is None
|
||||
# assert utxo_collection.count_documents({}) == 0
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_store_one_unspent_output(db_context,
|
||||
# @pytest.mark.skip
|
||||
# def test_store_one_unspent_output(db_context,
|
||||
# unspent_output_1, utxo_collection):
|
||||
# from planetmint.backend import query
|
||||
# res = query.store_unspent_outputs(db_context.conn, unspent_output_1)
|
||||
@ -371,8 +371,8 @@
|
||||
# 'output_index': unspent_output_1['output_index']}
|
||||
# ) == 1
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_store_many_unspent_outputs(db_context,
|
||||
# @pytest.mark.skip
|
||||
# def test_store_many_unspent_outputs(db_context,
|
||||
# unspent_outputs, utxo_collection):
|
||||
# from planetmint.backend import query
|
||||
# res = query.store_unspent_outputs(db_context.conn, *unspent_outputs)
|
||||
@ -382,8 +382,8 @@
|
||||
# {'transaction_id': unspent_outputs[0]['transaction_id']}
|
||||
# ) == 3
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_unspent_outputs(db_context, utxoset):
|
||||
# @pytest.mark.skip
|
||||
# def test_get_unspent_outputs(db_context, utxoset):
|
||||
# from planetmint.backend import query
|
||||
# cursor = query.get_unspent_outputs(db_context.conn)
|
||||
# assert cursor.collection.count_documents({}) == 3
|
||||
@ -393,8 +393,8 @@
|
||||
# utxo_collection.find(projection={'_id': False}))
|
||||
# assert retrieved_utxoset == unspent_outputs
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_store_pre_commit_state(db_context):
|
||||
# @pytest.mark.skip
|
||||
# def test_store_pre_commit_state(db_context):
|
||||
# from planetmint.backend import query
|
||||
#
|
||||
# state = dict(height=3, transactions=[])
|
||||
@ -404,8 +404,8 @@
|
||||
# projection={'_id': False})
|
||||
# assert cursor.collection.count_documents({}) == 1
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_get_pre_commit_state(db_context):
|
||||
# @pytest.mark.skip
|
||||
# def test_get_pre_commit_state(db_context):
|
||||
# from planetmint.backend import query
|
||||
#
|
||||
# state = dict(height=3, transactions=[])
|
||||
@ -413,8 +413,8 @@
|
||||
# resp = query.get_pre_commit_state(db_context.conn)
|
||||
# assert resp == state
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#def test_validator_update():
|
||||
# @pytest.mark.skip
|
||||
# def test_validator_update():
|
||||
# from planetmint.backend import connect, query
|
||||
#
|
||||
# conn = connect()
|
||||
@ -435,8 +435,8 @@
|
||||
# v91 = query.get_validator_set(conn)
|
||||
# assert v91['height'] == 91
|
||||
#
|
||||
#@pytest.mark.skip
|
||||
#@pytest.mark.parametrize('description,stores,expected', [
|
||||
# @pytest.mark.skip
|
||||
# @pytest.mark.parametrize('description,stores,expected', [
|
||||
# (
|
||||
# 'Query empty database.',
|
||||
# [],
|
||||
@ -473,8 +473,8 @@
|
||||
# ],
|
||||
# {'height': 10, 'chain_id': 'another-id', 'is_synced': True},
|
||||
# ),
|
||||
#])
|
||||
#def test_store_abci_chain(description, stores, expected):
|
||||
# ])
|
||||
# def test_store_abci_chain(description, stores, expected):
|
||||
# conn = connect()
|
||||
#
|
||||
# for store in stores:
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
## 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
|
||||
# # 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
|
||||
#
|
||||
#
|
||||
#def test_init_database_is_graceful_if_db_exists():
|
||||
# def test_init_database_is_graceful_if_db_exists():
|
||||
# import planetmint
|
||||
# from planetmint import backend
|
||||
# from planetmint.backend.schema import init_database
|
||||
@ -18,7 +18,7 @@
|
||||
# init_database()
|
||||
#
|
||||
#
|
||||
#def test_create_tables():
|
||||
# def test_create_tables():
|
||||
# import planetmint
|
||||
# from planetmint import backend
|
||||
# from planetmint.backend import schema
|
||||
@ -66,7 +66,7 @@
|
||||
# assert indexes['height']['unique']
|
||||
#
|
||||
#
|
||||
#def test_drop(dummy_db):
|
||||
# def test_drop(dummy_db):
|
||||
# from planetmint import backend
|
||||
# from planetmint.backend import schema
|
||||
#
|
||||
@ -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
|
||||
|
||||
|
||||
@ -40,10 +40,10 @@ def mock_generate_key_pair(monkeypatch):
|
||||
@pytest.fixture
|
||||
def mock_planetmint_backup_config(monkeypatch):
|
||||
_config = Config().get()
|
||||
_config['database']['host']='host'
|
||||
_config['database']['port']=12345
|
||||
_config['database']['name']='adbname'
|
||||
Config().set( _config )
|
||||
_config['database']['host'] = 'host'
|
||||
_config['database']['port'] = 12345
|
||||
_config['database']['name'] = 'adbname'
|
||||
Config().set(_config)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
@ -125,7 +125,7 @@ def test_drop_db_when_interactive_yes(mock_db_drop, monkeypatch):
|
||||
def test_drop_db_when_db_does_not_exist(mock_db_drop, capsys):
|
||||
from planetmint.transactions.common.exceptions import DatabaseDoesNotExist
|
||||
from planetmint.commands.planetmint import run_drop
|
||||
|
||||
|
||||
args = Namespace(config=None, yes=True)
|
||||
mock_db_drop.side_effect = DatabaseDoesNotExist
|
||||
|
||||
|
||||
@ -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