mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 06:25:45 +00:00
adjusted some test cases
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
66acfa87b1
commit
f03d9ce925
@ -27,7 +27,7 @@ def test_validate_transfer_asset_id_mismatch(b, signed_create_tx, user_pk, user_
|
|||||||
from transactions.common.exceptions import AssetIdMismatch
|
from transactions.common.exceptions import AssetIdMismatch
|
||||||
|
|
||||||
tx_transfer = Transfer.generate(signed_create_tx.to_inputs(), [([user_pk], 1)], [signed_create_tx.id])
|
tx_transfer = Transfer.generate(signed_create_tx.to_inputs(), [([user_pk], 1)], [signed_create_tx.id])
|
||||||
tx_transfer.asset["id"] = "a" * 64
|
tx_transfer.assets[0]["id"] = "a" * 64
|
||||||
tx_transfer_signed = tx_transfer.sign([user_sk])
|
tx_transfer_signed = tx_transfer.sign([user_sk])
|
||||||
|
|
||||||
b.store_bulk_transactions([signed_create_tx])
|
b.store_bulk_transactions([signed_create_tx])
|
||||||
@ -40,7 +40,7 @@ def test_get_asset_id_create_transaction(alice, user_pk):
|
|||||||
from transactions.common.transaction import Transaction
|
from transactions.common.transaction import Transaction
|
||||||
|
|
||||||
tx_create = Create.generate([alice.public_key], [([user_pk], 1)])
|
tx_create = Create.generate([alice.public_key], [([user_pk], 1)])
|
||||||
assert Transaction.get_asset_ids(tx_create)[0] == tx_create.id
|
assert Transaction.get_asset_id(tx_create) == tx_create.id
|
||||||
|
|
||||||
|
|
||||||
def test_get_asset_id_transfer_transaction(b, signed_create_tx, user_pk):
|
def test_get_asset_id_transfer_transaction(b, signed_create_tx, user_pk):
|
||||||
|
|||||||
@ -54,7 +54,7 @@ metadata = {"units": 300, "type": "KG"}
|
|||||||
def test_zenroom_signing():
|
def test_zenroom_signing():
|
||||||
|
|
||||||
biolabs = generate_key_pair()
|
biolabs = generate_key_pair()
|
||||||
version = "2.0"
|
version = "3.0"
|
||||||
|
|
||||||
alice = json.loads(zencode_exec(GENERATE_KEYPAIR).output)["keyring"]
|
alice = json.loads(zencode_exec(GENERATE_KEYPAIR).output)["keyring"]
|
||||||
bob = json.loads(zencode_exec(GENERATE_KEYPAIR).output)["keyring"]
|
bob = json.loads(zencode_exec(GENERATE_KEYPAIR).output)["keyring"]
|
||||||
@ -101,7 +101,7 @@ def test_zenroom_signing():
|
|||||||
metadata = {"result": {"output": ["ok"]}}
|
metadata = {"result": {"output": ["ok"]}}
|
||||||
token_creation_tx = {
|
token_creation_tx = {
|
||||||
"operation": "CREATE",
|
"operation": "CREATE",
|
||||||
"asset": {"data": multihash(marshal({"test": "my asset"}))},
|
"assets": [{"data": multihash(marshal({"test": "my asset"}))}],
|
||||||
"metadata": multihash(marshal(metadata)),
|
"metadata": multihash(marshal(metadata)),
|
||||||
"script": script_,
|
"script": script_,
|
||||||
"outputs": [
|
"outputs": [
|
||||||
|
|||||||
@ -214,9 +214,9 @@ def test_get_spending_transactions(user_pk, user_sk, db_conn):
|
|||||||
tx1 = Create.generate([user_pk], out * 3)
|
tx1 = Create.generate([user_pk], out * 3)
|
||||||
tx1.sign([user_sk])
|
tx1.sign([user_sk])
|
||||||
inputs = tx1.to_inputs()
|
inputs = tx1.to_inputs()
|
||||||
tx2 = Transfer.generate([inputs[0]], out, tx1.id).sign([user_sk])
|
tx2 = Transfer.generate([inputs[0]], out, [tx1.id]).sign([user_sk])
|
||||||
tx3 = Transfer.generate([inputs[1]], out, tx1.id).sign([user_sk])
|
tx3 = Transfer.generate([inputs[1]], out, [tx1.id]).sign([user_sk])
|
||||||
tx4 = Transfer.generate([inputs[2]], out, tx1.id).sign([user_sk])
|
tx4 = Transfer.generate([inputs[2]], out, [tx1.id]).sign([user_sk])
|
||||||
txns = [deepcopy(tx.to_dict()) for tx in [tx1, tx2, tx3, tx4]]
|
txns = [deepcopy(tx.to_dict()) for tx in [tx1, tx2, tx3, tx4]]
|
||||||
query.store_transactions(signed_transactions=txns, connection=db_conn)
|
query.store_transactions(signed_transactions=txns, connection=db_conn)
|
||||||
|
|
||||||
@ -239,13 +239,13 @@ def test_get_spending_transactions_multiple_inputs(db_conn):
|
|||||||
tx1 = Create.generate([alice_pk], out).sign([alice_sk])
|
tx1 = Create.generate([alice_pk], out).sign([alice_sk])
|
||||||
|
|
||||||
inputs1 = tx1.to_inputs()
|
inputs1 = tx1.to_inputs()
|
||||||
tx2 = Transfer.generate([inputs1[0]], [([alice_pk], 6), ([bob_pk], 3)], tx1.id).sign([alice_sk])
|
tx2 = Transfer.generate([inputs1[0]], [([alice_pk], 6), ([bob_pk], 3)], [tx1.id]).sign([alice_sk])
|
||||||
|
|
||||||
inputs2 = tx2.to_inputs()
|
inputs2 = tx2.to_inputs()
|
||||||
tx3 = Transfer.generate([inputs2[0]], [([bob_pk], 3), ([carol_pk], 3)], tx1.id).sign([alice_sk])
|
tx3 = Transfer.generate([inputs2[0]], [([bob_pk], 3), ([carol_pk], 3)], [tx1.id]).sign([alice_sk])
|
||||||
|
|
||||||
inputs3 = tx3.to_inputs()
|
inputs3 = tx3.to_inputs()
|
||||||
tx4 = Transfer.generate([inputs2[1], inputs3[0]], [([carol_pk], 6)], tx1.id).sign([bob_sk])
|
tx4 = Transfer.generate([inputs2[1], inputs3[0]], [([carol_pk], 6)], [tx1.id]).sign([bob_sk])
|
||||||
|
|
||||||
txns = [deepcopy(tx.to_dict()) for tx in [tx1, tx2, tx3, tx4]]
|
txns = [deepcopy(tx.to_dict()) for tx in [tx1, tx2, tx3, tx4]]
|
||||||
query.store_transactions(signed_transactions=txns, connection=db_conn)
|
query.store_transactions(signed_transactions=txns, connection=db_conn)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user