Changes to run tests without error

This commit is contained in:
Sangat Das 2022-01-18 15:44:06 +00:00
parent a95bbae9e6
commit 69cc70de74
17 changed files with 78 additions and 78 deletions

View File

@ -50,7 +50,7 @@ class StandaloneApplication(gunicorn.app.base.BaseApplication):
config = dict((key, value) for key, value in self.options.items()
if key in self.cfg.settings and value is not None)
config['default_proc_name'] = 'bigchaindb_gunicorn'
config['default_proc_name'] = 'planetmint_gunicorn'
for key, value in config.items():
# not sure if we need the `key.lower` here, will just keep
# keep it for now.
@ -72,7 +72,7 @@ def create_app(*, debug=False, threads=1, bigchaindb_factory=None):
"""
if not bigchaindb_factory:
bigchaindb_factory = Planetmint
bigchaindb_factory = BigchainDB
app = Flask(__name__)
app.wsgi_app = StripContentTypeMiddleware(app.wsgi_app)

View File

@ -15,8 +15,8 @@ def test_get_connection_raises_a_configuration_error(monkeypatch):
with pytest.raises(ConfigurationError):
# We need to force a misconfiguration here
monkeypatch.setattr('bigchaindb.backend.connection.BACKENDS',
monkeypatch.setattr('planetmint.backend.connection.BACKENDS',
{'catsandra':
'bigchaindb.backend.meowmeow.Catsandra'})
'planetmint.backend.meowmeow.Catsandra'})
connect('catsandra', 'localhost', '1337', 'mydb')

View File

@ -34,7 +34,7 @@ def mock_processes_start(monkeypatch):
@pytest.fixture
def mock_generate_key_pair(monkeypatch):
monkeypatch.setattr('bigchaindb.common.crypto.generate_key_pair', lambda: ('privkey', 'pubkey'))
monkeypatch.setattr('planetmint.common.crypto.generate_key_pair', lambda: ('privkey', 'pubkey'))
@pytest.fixture
@ -42,7 +42,7 @@ def mock_bigchaindb_backup_config(monkeypatch):
config = {
'database': {'host': 'host', 'port': 12345, 'name': 'adbname'},
}
monkeypatch.setattr('bigchaindb._config', config)
monkeypatch.setattr('planetmint._config', config)
@pytest.fixture
@ -57,7 +57,7 @@ def run_start_args(request):
@pytest.fixture
def mocked_setup_logging(mocker):
return mocker.patch(
'bigchaindb.log.setup_logging',
'planetmint.log.setup_logging',
autospec=True,
spec_set=True,
)

View File

@ -41,7 +41,7 @@ def test_make_sure_we_dont_remove_any_command():
assert parser.parse_args(['tendermint-version']).command
@patch('bigchaindb.commands.utils.start')
@patch('planetmint.commands.utils.start')
def test_main_entrypoint(mock_start):
from planetmint.commands.planetmint import main
main()
@ -49,9 +49,9 @@ def test_main_entrypoint(mock_start):
assert mock_start.called
@patch('bigchaindb.log.setup_logging')
@patch('bigchaindb.commands.bigchaindb._run_init')
@patch('bigchaindb.config_utils.autoconfigure')
@patch('planetmint.log.setup_logging')
@patch('planetmint.commands.planetmint._run_init')
@patch('planetmint.config_utils.autoconfigure')
def test_bigchain_run_start(mock_setup_logging, mock_run_init,
mock_autoconfigure, mock_processes_start):
from planetmint.commands.planetmint import run_start
@ -78,7 +78,7 @@ def test_bigchain_show_config(capsys):
# PLANETMINT_SERVER_BIND, PLANETMINT_WSSERVER_HOST, PLANETMINT_WSSERVER_ADVERTISED_HOST
# the default comparison fails i.e. when config is imported at the beginning the
# dict returned is different that what is expected after run_show_config
# and run_show_config updates the bigchaindb.config
# and run_show_config updates the planetmint.config
from planetmint import config
del config['CONFIGURED']
assert output_config == config
@ -87,9 +87,9 @@ def test_bigchain_show_config(capsys):
def test__run_init(mocker):
from planetmint.commands.planetmint import _run_init
bigchain_mock = mocker.patch(
'bigchaindb.commands.bigchaindb.bigchaindb.Planetmint')
'planetmint.commands.planetmint.planetmint.BigchainDB')
init_db_mock = mocker.patch(
'bigchaindb.commands.bigchaindb.schema.init_database',
'planetmint.commands.planetmint.schema.init_database',
autospec=True,
spec_set=True,
)
@ -99,7 +99,7 @@ def test__run_init(mocker):
connection=bigchain_mock.return_value.connection)
@patch('bigchaindb.backend.schema.drop_database')
@patch('planetmint.backend.schema.drop_database')
def test_drop_db_when_assumed_yes(mock_db_drop):
from planetmint.commands.planetmint import run_drop
args = Namespace(config=None, yes=True)
@ -108,18 +108,18 @@ def test_drop_db_when_assumed_yes(mock_db_drop):
assert mock_db_drop.called
@patch('bigchaindb.backend.schema.drop_database')
@patch('planetmint.backend.schema.drop_database')
def test_drop_db_when_interactive_yes(mock_db_drop, monkeypatch):
from planetmint.commands.planetmint import run_drop
args = Namespace(config=None, yes=False)
monkeypatch.setattr(
'bigchaindb.commands.bigchaindb.input_on_stderr', lambda x: 'y')
'planetmint.commands.planetmint.input_on_stderr', lambda x: 'y')
run_drop(args)
assert mock_db_drop.called
@patch('bigchaindb.backend.schema.drop_database')
@patch('planetmint.backend.schema.drop_database')
def test_drop_db_when_db_does_not_exist(mock_db_drop, capsys):
from planetmint import config
from planetmint.commands.planetmint import run_drop
@ -133,12 +133,12 @@ def test_drop_db_when_db_does_not_exist(mock_db_drop, capsys):
name=config['database']['name'])
@patch('bigchaindb.backend.schema.drop_database')
@patch('planetmint.backend.schema.drop_database')
def test_drop_db_does_not_drop_when_interactive_no(mock_db_drop, monkeypatch):
from planetmint.commands.planetmint import run_drop
args = Namespace(config=None, yes=False)
monkeypatch.setattr(
'bigchaindb.commands.bigchaindb.input_on_stderr', lambda x: 'n')
'planetmint.commands.planetmint.input_on_stderr', lambda x: 'n')
run_drop(args)
assert not mock_db_drop.called
@ -172,7 +172,7 @@ def test_run_configure_when_config_does_exist(monkeypatch,
monkeypatch.setattr('os.path.exists', lambda path: True)
monkeypatch.setattr('builtins.input', lambda: '\n')
monkeypatch.setattr(
'bigchaindb.config_utils.write_config', mock_write_config)
'planetmint.config_utils.write_config', mock_write_config)
args = Namespace(config=None, yes=None)
run_configure(args)
@ -194,7 +194,7 @@ def test_run_configure_with_backend(backend, monkeypatch, mock_write_config):
monkeypatch.setattr('os.path.exists', lambda path: False)
monkeypatch.setattr('builtins.input', lambda: '\n')
monkeypatch.setattr('bigchaindb.config_utils.write_config',
monkeypatch.setattr('planetmint.config_utils.write_config',
mock_write_config)
args = Namespace(config=None, backend=backend, yes=True)
@ -209,7 +209,7 @@ def test_run_configure_with_backend(backend, monkeypatch, mock_write_config):
assert value['return'] == expected_config
@patch('bigchaindb.commands.utils.start')
@patch('planetmint.commands.utils.start')
def test_calling_main(start_mock, monkeypatch):
from planetmint.commands.planetmint import main
@ -242,8 +242,8 @@ def test_calling_main(start_mock, monkeypatch):
assert start_mock.called is True
@patch('bigchaindb.commands.bigchaindb.run_recover')
@patch('bigchaindb.start.start')
@patch('planetmint.commands.planetmint.run_recover')
@patch('planetmint.start.start')
def test_recover_db_on_start(mock_run_recover,
mock_start,
mocked_setup_logging):

View File

@ -15,7 +15,7 @@ from unittest.mock import patch
@pytest.fixture
def reset_bigchaindb_config(monkeypatch):
import planetmint
monkeypatch.setattr('bigchaindb.config', planetmint._config)
monkeypatch.setattr('planetmint.config', planetmint._config)
def test_input_on_stderr():

View File

@ -32,7 +32,7 @@ from planetmint.common.exceptions import DatabaseDoesNotExist
from planetmint.lib import Block
from tests.utils import gen_vote
TEST_DB_NAME = 'bigchain_test'
TEST_DB_NAME = 'planetmint_test'
USER2_SK, USER2_PK = crypto.generate_key_pair()
@ -157,7 +157,7 @@ def ignore_local_config_file(monkeypatch):
def mock_file_config(filename=None):
return {}
monkeypatch.setattr('bigchaindb.config_utils.file_config',
monkeypatch.setattr('planetmint.config_utils.file_config',
mock_file_config)
@ -243,7 +243,7 @@ def a():
@pytest.fixture
def b():
from planetmint import BigchainDB
return BigchainDB)
return BigchainDB()
@pytest.fixture

View File

@ -75,7 +75,7 @@ class TestBigchainApi(object):
b.store_bulk_transactions([tx1, tx2, tx3])
# get the assets through text search
assets = list(b.text_search('bigchaindb'))
assets = list(b.text_search('planetmint'))
assert len(assets) == 3
@pytest.mark.usefixtures('inputs')
@ -448,14 +448,14 @@ def test_get_outputs_filtered_only_unspent():
from planetmint.common.transaction import TransactionLink
from planetmint.lib import BigchainDB
go = 'bigchaindb.fastquery.FastQuery.get_outputs_by_public_key'
go = 'planetmint.fastquery.FastQuery.get_outputs_by_public_key'
with patch(go) as get_outputs:
get_outputs.return_value = [TransactionLink('a', 1),
TransactionLink('b', 2)]
fs = 'bigchaindb.fastquery.FastQuery.filter_spent_outputs'
fs = 'planetmint.fastquery.FastQuery.filter_spent_outputs'
with patch(fs) as filter_spent:
filter_spent.return_value = [TransactionLink('b', 2)]
out = BigchainDB).get_outputs_filtered('abc', spent=False)
out = BigchainDB().get_outputs_filtered('abc', spent=False)
get_outputs.assert_called_once_with('abc')
assert out == [TransactionLink('b', 2)]
@ -463,29 +463,29 @@ def test_get_outputs_filtered_only_unspent():
def test_get_outputs_filtered_only_spent():
from planetmint.common.transaction import TransactionLink
from planetmint.lib import BigchainDB
go = 'bigchaindb.fastquery.FastQuery.get_outputs_by_public_key'
go = 'planetmint.fastquery.FastQuery.get_outputs_by_public_key'
with patch(go) as get_outputs:
get_outputs.return_value = [TransactionLink('a', 1),
TransactionLink('b', 2)]
fs = 'bigchaindb.fastquery.FastQuery.filter_unspent_outputs'
fs = 'planetmint.fastquery.FastQuery.filter_unspent_outputs'
with patch(fs) as filter_spent:
filter_spent.return_value = [TransactionLink('b', 2)]
out = BigchainDB).get_outputs_filtered('abc', spent=True)
out = BigchainDB().get_outputs_filtered('abc', spent=True)
get_outputs.assert_called_once_with('abc')
assert out == [TransactionLink('b', 2)]
@patch('bigchaindb.fastquery.FastQuery.filter_unspent_outputs')
@patch('bigchaindb.fastquery.FastQuery.filter_spent_outputs')
@patch('planetmint.fastquery.FastQuery.filter_unspent_outputs')
@patch('planetmint.fastquery.FastQuery.filter_spent_outputs')
def test_get_outputs_filtered(filter_spent, filter_unspent):
from planetmint.common.transaction import TransactionLink
from planetmint.lib import BigchainDB
go = 'bigchaindb.fastquery.FastQuery.get_outputs_by_public_key'
go = 'planetmint.fastquery.FastQuery.get_outputs_by_public_key'
with patch(go) as get_outputs:
get_outputs.return_value = [TransactionLink('a', 1),
TransactionLink('b', 2)]
out = BigchainDB).get_outputs_filtered('abc')
out = BigchainDB().get_outputs_filtered('abc')
get_outputs.assert_called_once_with('abc')
filter_spent.assert_not_called()
filter_unspent.assert_not_called()

View File

@ -75,8 +75,8 @@ def test_get_latest_block(b):
@pytest.mark.bdb
@patch('bigchaindb.backend.query.get_block', return_value=None)
@patch('bigchaindb.Planetmint.get_latest_block', return_value={'height': 10})
@patch('planetmint.backend.query.get_block', return_value=None)
@patch('planetmint.BigchainDB.get_latest_block', return_value={'height': 10})
def test_get_empty_block(_0, _1, b):
assert b.get_block(5) == {'height': 5, 'transactions': []}
@ -171,11 +171,11 @@ def test_update_utxoset(b, signed_create_tx, signed_transfer_tx, db_context):
@pytest.mark.bdb
def test_store_transaction(mocker, b, signed_create_tx,
signed_transfer_tx, db_context):
mocked_store_asset = mocker.patch('bigchaindb.backend.query.store_assets')
mocked_store_asset = mocker.patch('planetmint.backend.query.store_assets')
mocked_store_metadata = mocker.patch(
'bigchaindb.backend.query.store_metadatas')
'planetmint.backend.query.store_metadatas')
mocked_store_transaction = mocker.patch(
'bigchaindb.backend.query.store_transactions')
'planetmint.backend.query.store_transactions')
b.store_bulk_transactions([signed_create_tx])
# mongo_client = MongoClient(host=db_context.host, port=db_context.port)
# utxoset = mongo_client[db_context.name]['utxos']
@ -221,11 +221,11 @@ def test_store_transaction(mocker, b, signed_create_tx,
def test_store_bulk_transaction(mocker, b, signed_create_tx,
signed_transfer_tx, db_context):
mocked_store_assets = mocker.patch(
'bigchaindb.backend.query.store_assets')
'planetmint.backend.query.store_assets')
mocked_store_metadata = mocker.patch(
'bigchaindb.backend.query.store_metadatas')
'planetmint.backend.query.store_metadatas')
mocked_store_transactions = mocker.patch(
'bigchaindb.backend.query.store_transactions')
'planetmint.backend.query.store_transactions')
b.store_bulk_transactions((signed_create_tx,))
# mongo_client = MongoClient(host=db_context.host, port=db_context.port)
# utxoset = mongo_client[db_context.name]['utxos']

View File

@ -19,7 +19,7 @@ def clean_config(monkeypatch, request):
original_config = copy.deepcopy(ORIGINAL_CONFIG)
backend = request.config.getoption('--database-backend')
original_config['database'] = planetmint._database_map[backend]
monkeypatch.setattr('bigchaindb.config', original_config)
monkeypatch.setattr('planetmint.config', original_config)
def test_bigchain_instance_is_initialized_when_conf_provided():
@ -156,7 +156,7 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request):
},
}
monkeypatch.setattr('bigchaindb.config_utils.file_config',
monkeypatch.setattr('planetmint.config_utils.file_config',
lambda *args, **kwargs: file_config)
monkeypatch.setattr('os.environ', {
@ -240,9 +240,9 @@ def test_autoconfigure_read_both_from_file_and_env(monkeypatch, request):
def test_autoconfigure_env_precedence(monkeypatch):
file_config = {
'database': {'host': 'test-host', 'name': 'bigchaindb', 'port': 28015}
'database': {'host': 'test-host', 'name': 'planetmint', 'port': 28015}
}
monkeypatch.setattr('bigchaindb.config_utils.file_config', lambda *args, **kwargs: file_config)
monkeypatch.setattr('planetmint.config_utils.file_config', lambda *args, **kwargs: file_config)
monkeypatch.setattr('os.environ', {'PLANETMINT_DATABASE_NAME': 'test-dbname',
'PLANETMINT_DATABASE_PORT': '4242',
'PLANETMINT_SERVER_BIND': 'localhost:9985'})
@ -264,7 +264,7 @@ def test_autoconfigure_explicit_file(monkeypatch):
def file_config(*args, **kwargs):
raise FileNotFoundError()
monkeypatch.setattr('bigchaindb.config_utils.file_config', file_config)
monkeypatch.setattr('planetmint.config_utils.file_config', file_config)
with pytest.raises(FileNotFoundError):
config_utils.autoconfigure(filename='autoexec.bat')
@ -275,16 +275,16 @@ def test_update_config(monkeypatch):
from planetmint import config_utils
file_config = {
'database': {'host': 'test-host', 'name': 'bigchaindb', 'port': 28015}
'database': {'host': 'test-host', 'name': 'planetmint', 'port': 28015}
}
monkeypatch.setattr('bigchaindb.config_utils.file_config', lambda *args, **kwargs: file_config)
monkeypatch.setattr('planetmint.config_utils.file_config', lambda *args, **kwargs: file_config)
config_utils.autoconfigure(config=file_config)
# update configuration, retaining previous changes
config_utils.update_config({'database': {'port': 28016, 'name': 'bigchaindb_other'}})
config_utils.update_config({'database': {'port': 28016, 'name': 'planetmint_other'}})
assert planetmint.config['database']['host'] == 'test-host'
assert planetmint.config['database']['name'] == 'bigchaindb_other'
assert planetmint.config['database']['name'] == 'planetmint_other'
assert planetmint.config['database']['port'] == 28016

View File

@ -29,7 +29,7 @@ def config(request, monkeypatch):
'CONFIGURED': True,
}
monkeypatch.setattr('bigchaindb.config', config)
monkeypatch.setattr('planetmint.config', config)
return config
@ -38,7 +38,7 @@ def test_bigchain_class_default_initialization(config):
from planetmint import BigchainDB
from planetmint.validation import BaseValidationRules
from planetmint.backend.connection import Connection
bigchain = BigchainDB)
bigchain = BigchainDB()
assert isinstance(bigchain.connection, Connection)
assert bigchain.connection.host == config['database']['host']
assert bigchain.connection.port == config['database']['port']
@ -57,7 +57,7 @@ def test_bigchain_class_initialization_with_parameters():
'name': 'this_is_the_db_name',
}
connection = connect(**init_db_kwargs)
bigchain = BigchainDBconnection=connection)
bigchain = BigchainDB(connection=connection)
assert bigchain.connection == connection
assert bigchain.connection.host == init_db_kwargs['host']
assert bigchain.connection.port == init_db_kwargs['port']

View File

@ -90,7 +90,7 @@ def test_parallel_validator_routes_transactions_correctly(b, monkeypatch):
return dict_transaction
monkeypatch.setattr(
'bigchaindb.parallel_validation.ValidationWorker.validate',
'planetmint.parallel_validation.ValidationWorker.validate',
validate)
# Transaction routing uses the `id` of the transaction. This test strips

View File

@ -19,7 +19,7 @@ def valid_upsert_validator_election_b(b, node_key, new_validator):
@pytest.fixture
@patch('bigchaindb.elections.election.uuid4', lambda: 'mock_uuid4')
@patch('planetmint.elections.election.uuid4', lambda: 'mock_uuid4')
def fixed_seed_election(b_mock, node_key, new_validator):
voters = ValidatorElection.recipients(b_mock)
return ValidatorElection.generate([node_key.public_key],

View File

@ -74,7 +74,7 @@ def test_upsert_validator_invalid_inputs_election(b_mock, new_validator, node_ke
election.validate(b_mock)
@patch('bigchaindb.elections.election.uuid4', lambda: 'mock_uuid4')
@patch('planetmint.elections.election.uuid4', lambda: 'mock_uuid4')
def test_upsert_validator_invalid_election(b_mock, new_validator, node_key, fixed_seed_election):
voters = ValidatorElection.recipients(b_mock)
duplicate_election = ValidatorElection.generate([node_key.public_key],

View File

@ -12,7 +12,7 @@ def app(request):
from planetmint.lib import BigchainDB
if request.config.getoption('--database-backend') == 'localmongodb':
app = server.create_app(debug=True, bigchaindb_factory=Planetmint)
app = server.create_app(debug=True, bigchaindb_factory=BigchainDB)
else:
app = server.create_app(debug=True)

View File

@ -6,8 +6,8 @@
from unittest import mock
@mock.patch('bigchaindb.version.__short_version__', 'tst')
@mock.patch('bigchaindb.version.__version__', 'tsttst')
@mock.patch('planetmint.version.__short_version__', 'tst')
@mock.patch('planetmint.version.__version__', 'tsttst')
def test_api_root_endpoint(client, wsserver_base_url):
res = client.get('/')
docs_url = ['https://docs.bigchaindb.com/projects/server/en/vtsttst',
@ -32,8 +32,8 @@ def test_api_root_endpoint(client, wsserver_base_url):
}
@mock.patch('bigchaindb.version.__short_version__', 'tst')
@mock.patch('bigchaindb.version.__version__', 'tsttst')
@mock.patch('planetmint.version.__short_version__', 'tst')
@mock.patch('planetmint.version.__version__', 'tsttst')
def test_api_v1_endpoint(client, wsserver_base_url):
docs_url = ['https://docs.bigchaindb.com/projects/server/en/vtsttst',
'/http-client-server-api.html']

View File

@ -16,7 +16,7 @@ def test_get_outputs_endpoint(client, user_pk):
m = MagicMock()
m.txid = 'a'
m.output = 0
with patch('bigchaindb.Planetmint.get_outputs_filtered') as gof:
with patch('planetmint.BigchainDB.get_outputs_filtered') as gof:
gof.return_value = [m, m]
res = client.get(OUTPUTS_ENDPOINT + '?public_key={}'.format(user_pk))
assert res.json == [
@ -31,7 +31,7 @@ def test_get_outputs_endpoint_unspent(client, user_pk):
m = MagicMock()
m.txid = 'a'
m.output = 0
with patch('bigchaindb.Planetmint.get_outputs_filtered') as gof:
with patch('planetmint.BigchainDB.get_outputs_filtered') as gof:
gof.return_value = [m]
params = '?spent=False&public_key={}'.format(user_pk)
res = client.get(OUTPUTS_ENDPOINT + params)
@ -46,7 +46,7 @@ def test_get_outputs_endpoint_spent(client, user_pk):
m = MagicMock()
m.txid = 'a'
m.output = 0
with patch('bigchaindb.Planetmint.get_outputs_filtered') as gof:
with patch('planetmint.BigchainDB.get_outputs_filtered') as gof:
gof.return_value = [m]
params = '?spent=true&public_key={}'.format(user_pk)
res = client.get(OUTPUTS_ENDPOINT + params)

View File

@ -131,7 +131,7 @@ def test_post_create_transaction_with_invalid_key(b, client, field, value,
@pytest.mark.abci
@patch('bigchaindb.web.views.base.logger')
@patch('planetmint.web.views.base.logger')
def test_post_create_transaction_with_invalid_id(mock_logger, b, client):
from planetmint.common.exceptions import InvalidHash
from planetmint.models import Transaction
@ -166,7 +166,7 @@ def test_post_create_transaction_with_invalid_id(mock_logger, b, client):
@pytest.mark.abci
@patch('bigchaindb.web.views.base.logger')
@patch('planetmint.web.views.base.logger')
def test_post_create_transaction_with_invalid_signature(mock_logger,
b,
client):
@ -216,7 +216,7 @@ def test_post_create_transaction_with_invalid_structure(client):
@pytest.mark.abci
@patch('bigchaindb.web.views.base.logger')
@patch('planetmint.web.views.base.logger')
def test_post_create_transaction_with_invalid_schema(mock_logger, client):
from planetmint.models import Transaction
user_priv, user_pub = crypto.generate_key_pair()
@ -272,7 +272,7 @@ def test_post_create_transaction_with_invalid_schema(mock_logger, client):
('TransactionOwnerError', 'Not yours!'),
('ValidationError', '?'),
))
@patch('bigchaindb.web.views.base.logger')
@patch('planetmint.web.views.base.logger')
def test_post_invalid_transaction(mock_logger, client, exc, msg, monkeypatch,):
from planetmint.common import exceptions
exc_cls = getattr(exceptions, exc)
@ -283,7 +283,7 @@ def test_post_invalid_transaction(mock_logger, client, exc, msg, monkeypatch,):
TransactionMock = Mock(validate=mock_validation)
monkeypatch.setattr(
'bigchaindb.models.Transaction.from_dict', lambda tx: TransactionMock)
'planetmint.models.Transaction.from_dict', lambda tx: TransactionMock)
res = client.post(TX_ENDPOINT, data=json.dumps({}))
expected_status_code = 400
expected_error_message = 'Invalid transaction ({}): {}'.format(exc, msg)
@ -379,7 +379,7 @@ def test_transactions_get_list_good(client):
asset_id = '1' * 64
with patch('bigchaindb.Planetmint.get_transactions_filtered', get_txs_patched):
with patch('planetmint.BigchainDB.get_transactions_filtered', get_txs_patched):
url = TX_ENDPOINT + '?asset_id=' + asset_id
assert client.get(url).json == [
['asset_id', asset_id],
@ -403,7 +403,7 @@ def test_transactions_get_list_good(client):
def test_transactions_get_list_bad(client):
def should_not_be_called():
assert False
with patch('bigchaindb.Planetmint.get_transactions_filtered',
with patch('planetmint.BigchainDB.get_transactions_filtered',
lambda *_, **__: should_not_be_called()):
# Test asset id validated
url = TX_ENDPOINT + '?asset_id=' + '1' * 63