mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 22:45:44 +00:00
test_store_block PASSED
This commit is contained in:
parent
954363aaa1
commit
ca6ebfae0b
@ -43,7 +43,8 @@ def _group_transaction_by_ids(txids: list, connection):
|
|||||||
"inputs": [
|
"inputs": [
|
||||||
{
|
{
|
||||||
"owners_before": _in[2],
|
"owners_before": _in[2],
|
||||||
"fulfills": {"transaction_id": _in[3], "output_index": int(_in[4])} if len(_in[3]) > 0 and len( # TODO Now it is working because of data type cast to INTEGER for field "output_index"
|
"fulfills": {"transaction_id": _in[3], "output_index": int(_in[4])} if len(_in[3]) > 0 and len(
|
||||||
|
# TODO Now it is working because of data type cast to INTEGER for field "output_index"
|
||||||
_in[4]) > 0 else None,
|
_in[4]) > 0 else None,
|
||||||
"fulfillment": _in[1]
|
"fulfillment": _in[1]
|
||||||
} for _in in _txinputs
|
} for _in in _txinputs
|
||||||
@ -307,7 +308,7 @@ def get_spending_transactions(inputs, connection):
|
|||||||
|
|
||||||
|
|
||||||
# @register_query(LocalMongoDBConnection)
|
# @register_query(LocalMongoDBConnection)
|
||||||
def get_block(block_id: str, connection):
|
def get_block(block_id=[], connection=None):
|
||||||
space = connection.space("blocks")
|
space = connection.space("blocks")
|
||||||
_block = space.select(block_id, index="block_search", limit=1)
|
_block = space.select(block_id, index="block_search", limit=1)
|
||||||
_block = _block.data[0]
|
_block = _block.data[0]
|
||||||
|
|||||||
@ -294,16 +294,19 @@ def test_get_spending_transactions_multiple_inputs():
|
|||||||
|
|
||||||
|
|
||||||
def test_store_block():
|
def test_store_block():
|
||||||
from planetmint.backend import connect, query
|
|
||||||
from planetmint.lib import Block
|
from planetmint.lib import Block
|
||||||
conn = connect()
|
from planetmint.backend import connect
|
||||||
|
from planetmint.backend.tarantool import query
|
||||||
|
|
||||||
|
conn = connect().get_connection()
|
||||||
|
|
||||||
block = Block(app_hash='random_utxo',
|
block = Block(app_hash='random_utxo',
|
||||||
height=3,
|
height=3,
|
||||||
transactions=[])
|
transactions=[])
|
||||||
query.store_block(conn, block._asdict())
|
query.store_block(connection=conn, block=block._asdict())
|
||||||
cursor = conn.db.blocks.find({}, projection={'_id': False})
|
# block = query.get_block(connection=conn)
|
||||||
assert cursor.collection.count_documents({}) == 1
|
blocks = conn.space("blocks").select([])
|
||||||
|
assert len(blocks.data) == 1
|
||||||
|
|
||||||
|
|
||||||
def test_get_block():
|
def test_get_block():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user