mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
get_metadata test function pass
This commit is contained in:
parent
a0a47789eb
commit
516084bf58
@ -116,7 +116,7 @@ def get_transactions(transactions_ids: list, connection):
|
|||||||
def store_metadatas(metadata: list, connection):
|
def store_metadatas(metadata: list, connection):
|
||||||
space = connection.space("meta_data")
|
space = connection.space("meta_data")
|
||||||
for meta in metadata:
|
for meta in metadata:
|
||||||
space.insert((meta["id"], meta["data"]))
|
space.insert((meta["id"], meta["data"] if not "metadata" in meta else meta["metadata"]))
|
||||||
|
|
||||||
|
|
||||||
# @register_query(LocalMongoDBConnection)
|
# @register_query(LocalMongoDBConnection)
|
||||||
|
|||||||
@ -194,19 +194,20 @@ def test_write_metadata():
|
|||||||
|
|
||||||
|
|
||||||
def test_get_metadata():
|
def test_get_metadata():
|
||||||
from planetmint.backend import connect, query
|
from planetmint.backend import connect
|
||||||
conn = connect()
|
from planetmint.backend.tarantool import query
|
||||||
|
conn = connect().get_connection()
|
||||||
|
|
||||||
metadata = [
|
metadata = [
|
||||||
{'id': 1, 'metadata': None},
|
{'id': "dd86682db39e4b424df0eec1413cfad65488fd48712097c5d865ca8e8e059b64", 'metadata': None},
|
||||||
{'id': 2, 'metadata': {'key': 'value'}},
|
{'id': "55a2303e3bcd653e4b5bd7118d39c0e2d48ee2f18e22fbcf64e906439bdeb45d", 'metadata': {'key': 'value'}},
|
||||||
{'id': 3, 'metadata': '3'},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
conn.db.metadata.insert_many(deepcopy(metadata), ordered=False)
|
# conn.db.metadata.insert_many(deepcopy(metadata), ordered=False)
|
||||||
|
query.store_metadatas(connection=conn, metadata=metadata)
|
||||||
|
|
||||||
for meta in metadata:
|
for meta in metadata:
|
||||||
assert query.get_metadata(conn, [meta['id']])
|
assert query.get_metadata(connection=conn, transaction_ids=[meta["id"]])
|
||||||
|
|
||||||
|
|
||||||
def test_get_owned_ids(signed_create_tx, user_pk):
|
def test_get_owned_ids(signed_create_tx, user_pk):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user