mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
passed get_pre_commit_state
This commit is contained in:
parent
6fdcceefbf
commit
6cc8a6cbb4
@ -407,7 +407,7 @@ def get_pre_commit_state(connection) -> dict:
|
||||
if len(_commit) == 0:
|
||||
return {}
|
||||
_commit = _commit[0]
|
||||
return {"height": _commit[0], "transactions": _commit[1]}
|
||||
return {"height": _commit[1], "transactions": _commit[2]}
|
||||
|
||||
|
||||
# @register_query(LocalMongoDBConnection)
|
||||
|
||||
@ -441,11 +441,19 @@ def test_store_pre_commit_state(db_context):
|
||||
|
||||
|
||||
def test_get_pre_commit_state(db_context):
|
||||
from planetmint.backend import query
|
||||
from planetmint.backend import connect
|
||||
from planetmint.backend.tarantool import query
|
||||
|
||||
conn = connect().get_connection()
|
||||
space = conn.space("pre_commits")
|
||||
all_pre = space.select([])
|
||||
for pre in all_pre.data:
|
||||
space.delete(pre[0])
|
||||
# TODO First IN, First OUT
|
||||
state = dict(height=3, transactions=[])
|
||||
db_context.conn.db.pre_commit.insert_one(state)
|
||||
resp = query.get_pre_commit_state(db_context.conn)
|
||||
# db_context.conn.db.pre_commit.insert_one(state)
|
||||
query.store_pre_commit_state(state=state, connection=conn)
|
||||
resp = query.get_pre_commit_state(connection=conn)
|
||||
assert resp == state
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user