mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 15:05:49 +00:00
fixed acceptance test cases
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
parent
d723f87308
commit
4a736e9ff5
@ -78,7 +78,7 @@ def test_basic():
|
|||||||
|
|
||||||
# A `TRANSFER` transaction contains a pointer to the original asset. The original asset
|
# A `TRANSFER` transaction contains a pointer to the original asset. The original asset
|
||||||
# is identified by the `id` of the `CREATE` transaction that defined it.
|
# is identified by the `id` of the `CREATE` transaction that defined it.
|
||||||
transfer_asset = {'id': bike_id}
|
transfer_assets = [{'id': bike_id}]
|
||||||
|
|
||||||
# Alice wants to spend the one and only output available, the one with index `0`.
|
# Alice wants to spend the one and only output available, the one with index `0`.
|
||||||
output_index = 0
|
output_index = 0
|
||||||
@ -98,7 +98,7 @@ def test_basic():
|
|||||||
# Now that all the elements are set, she creates the actual transaction...
|
# Now that all the elements are set, she creates the actual transaction...
|
||||||
prepared_transfer_tx = bdb.transactions.prepare(
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
operation='TRANSFER',
|
operation='TRANSFER',
|
||||||
assets=transfer_asset,
|
assets=transfer_assets,
|
||||||
inputs=transfer_input,
|
inputs=transfer_input,
|
||||||
recipients=bob.public_key)
|
recipients=bob.public_key)
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ def test_divisible_assets():
|
|||||||
# the description, Bob and Alice agree that each token can be used to ride
|
# the description, Bob and Alice agree that each token can be used to ride
|
||||||
# the bike for one hour.
|
# the bike for one hour.
|
||||||
|
|
||||||
bike_token = {
|
bike_token = [{
|
||||||
'data': {
|
'data': {
|
||||||
'token_for': {
|
'token_for': {
|
||||||
'bike': {
|
'bike': {
|
||||||
@ -59,7 +59,7 @@ def test_divisible_assets():
|
|||||||
},
|
},
|
||||||
'description': 'Time share token. Each token equals one hour of riding.',
|
'description': 'Time share token. Each token equals one hour of riding.',
|
||||||
},
|
},
|
||||||
}
|
}]
|
||||||
|
|
||||||
# She prepares a `CREATE` transaction and issues 10 tokens.
|
# She prepares a `CREATE` transaction and issues 10 tokens.
|
||||||
# Here, Alice defines in a tuple that she wants to assign
|
# Here, Alice defines in a tuple that she wants to assign
|
||||||
@ -94,7 +94,7 @@ def test_divisible_assets():
|
|||||||
# To use the bike he has to send the tokens back to Alice.
|
# To use the bike he has to send the tokens back to Alice.
|
||||||
# To learn about the details of transferring a transaction check out
|
# To learn about the details of transferring a transaction check out
|
||||||
# [test_basic.py](./test_basic.html)
|
# [test_basic.py](./test_basic.html)
|
||||||
transfer_asset = {'id': bike_token_id}
|
transfer_assets = [{'id': bike_token_id}]
|
||||||
|
|
||||||
output_index = 0
|
output_index = 0
|
||||||
output = fulfilled_token_tx['outputs'][output_index]
|
output = fulfilled_token_tx['outputs'][output_index]
|
||||||
@ -108,7 +108,7 @@ def test_divisible_assets():
|
|||||||
# amount he wants to use to Alice.
|
# amount he wants to use to Alice.
|
||||||
prepared_transfer_tx = bdb.transactions.prepare(
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
operation='TRANSFER',
|
operation='TRANSFER',
|
||||||
assets=transfer_asset,
|
assets=transfer_assets,
|
||||||
inputs=transfer_input,
|
inputs=transfer_input,
|
||||||
recipients=[([alice.public_key], 3), ([bob.public_key], 7)])
|
recipients=[([alice.public_key], 3), ([bob.public_key], 7)])
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ def test_divisible_assets():
|
|||||||
# Now he wants to ride for 8 hours, that's a lot Bob!
|
# Now he wants to ride for 8 hours, that's a lot Bob!
|
||||||
# He prepares the transaction again.
|
# He prepares the transaction again.
|
||||||
|
|
||||||
transfer_asset = {'id': bike_token_id}
|
transfer_assets = [{'id': bike_token_id}]
|
||||||
# This time we need an `output_index` of 1, since we have two outputs
|
# This time we need an `output_index` of 1, since we have two outputs
|
||||||
# in the `fulfilled_transfer_tx` we created before. The first output with
|
# in the `fulfilled_transfer_tx` we created before. The first output with
|
||||||
# index 0 is for Alice and the second output is for Bob.
|
# index 0 is for Alice and the second output is for Bob.
|
||||||
@ -155,7 +155,7 @@ def test_divisible_assets():
|
|||||||
# to spend all his tokens
|
# to spend all his tokens
|
||||||
prepared_transfer_tx = bdb.transactions.prepare(
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
operation='TRANSFER',
|
operation='TRANSFER',
|
||||||
assets=transfer_asset,
|
assets=transfer_assets,
|
||||||
inputs=transfer_input,
|
inputs=transfer_input,
|
||||||
recipients=[([alice.public_key], 8)])
|
recipients=[([alice.public_key], 8)])
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ def test_double_create():
|
|||||||
bdb.transactions.prepare(
|
bdb.transactions.prepare(
|
||||||
operation='CREATE',
|
operation='CREATE',
|
||||||
signers=alice.public_key,
|
signers=alice.public_key,
|
||||||
assets={'data': {'uuid': str(uuid4())}}),
|
assets=[{'data': {'uuid': str(uuid4())}}]),
|
||||||
private_keys=alice.private_key)
|
private_keys=alice.private_key)
|
||||||
|
|
||||||
def send_and_queue(tx):
|
def send_and_queue(tx):
|
||||||
|
|||||||
@ -57,7 +57,7 @@ def test_multiple_owners():
|
|||||||
operation='CREATE',
|
operation='CREATE',
|
||||||
signers=alice.public_key,
|
signers=alice.public_key,
|
||||||
recipients=(alice.public_key, bob.public_key),
|
recipients=(alice.public_key, bob.public_key),
|
||||||
assets=dw_asset)
|
assets=[dw_asset])
|
||||||
|
|
||||||
# Now they both sign the transaction by providing their private keys.
|
# Now they both sign the transaction by providing their private keys.
|
||||||
# And send it afterwards.
|
# And send it afterwards.
|
||||||
@ -88,7 +88,7 @@ def test_multiple_owners():
|
|||||||
|
|
||||||
# Alice and Bob prepare the transaction to transfer the dish washer to
|
# Alice and Bob prepare the transaction to transfer the dish washer to
|
||||||
# Carol.
|
# Carol.
|
||||||
transfer_asset = {'id': dw_id}
|
transfer_assets = [{'id': dw_id}]
|
||||||
|
|
||||||
output_index = 0
|
output_index = 0
|
||||||
output = fulfilled_dw_tx['outputs'][output_index]
|
output = fulfilled_dw_tx['outputs'][output_index]
|
||||||
@ -101,7 +101,7 @@ def test_multiple_owners():
|
|||||||
# Now they create the transaction...
|
# Now they create the transaction...
|
||||||
prepared_transfer_tx = bdb.transactions.prepare(
|
prepared_transfer_tx = bdb.transactions.prepare(
|
||||||
operation='TRANSFER',
|
operation='TRANSFER',
|
||||||
assets=transfer_asset,
|
assets=transfer_assets,
|
||||||
inputs=transfer_input,
|
inputs=transfer_input,
|
||||||
recipients=carol.public_key)
|
recipients=carol.public_key)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user