def test_store_many_unspent_outputs(db_context, unspent_outputs, utxo_collection): from bigchaindb.backend import query res = query.store_unspent_outputs(db_context.conn, *unspent_outputs) assert res.acknowledged assert len(res.inserted_ids) == 3 assert utxo_collection.count_documents( {'transaction_id': unspent_outputs[0]['transaction_id']}) == 3
def test_store_many_unspent_outputs(db_context, unspent_outputs, utxo_collection): from bigchaindb.backend import query res = query.store_unspent_outputs(db_context.conn, *unspent_outputs) assert res.acknowledged assert len(res.inserted_ids) == 3 assert utxo_collection.find( {'transaction_id': unspent_outputs[0]['transaction_id']} ).count() == 3
def test_store_one_unspent_output(db_context, unspent_output_1, utxo_collection): from bigchaindb.backend import query res = query.store_unspent_outputs(db_context.conn, unspent_output_1) assert res.acknowledged assert len(res.inserted_ids) == 1 assert utxo_collection.find( {'transaction_id': unspent_output_1['transaction_id'], 'output_index': unspent_output_1['output_index']} ).count() == 1
def test_store_zero_unspent_output(db_context, utxo_collection): from bigchaindb.backend import query res = query.store_unspent_outputs(db_context.conn) assert res is None assert utxo_collection.count() == 0