Updated asset to assets on the acceptance/integration test suite

This commit is contained in:
ArpitShukla007 2022-04-28 12:40:14 +00:00
parent 904788749c
commit 99b5313981
18 changed files with 87 additions and 73 deletions

View File

@ -36,20 +36,22 @@ FULFILL_SCRIPT = \
When I verify the 'houses' has a signature in 'data.signature' by 'Alice' When I verify the 'houses' has a signature in 'data.signature' by 'Alice'
Then print the string 'ok'""" Then print the string 'ok'"""
HOUSE_ASSETS = { HOUSE_ASSETS = [
"data": { {
"houses": [ "data": {
{ "houses": [
"name": "Harry", {
"team": "Gryffindor", "name": "Harry",
}, "team": "Gryffindor",
{ },
"name": "Draco", {
"team": "Slytherin", "name": "Draco",
} "team": "Slytherin",
], }
],
}
} }
} ]
ZENROOM_DATA = { ZENROOM_DATA = {
'also': 'more data' 'also': 'more data'

View File

@ -44,13 +44,13 @@ def test_basic():
# ## Alice registers her bike in Planetmint # ## Alice registers her bike in Planetmint
# Alice has a nice bike, and here she creates the "digital twin" # Alice has a nice bike, and here she creates the "digital twin"
# of her bike. # of her bike.
bike = {'data': {'bicycle': {'serial_number': 420420}}} bike = [{'data': {'bicycle': {'serial_number': 420420}}}]
# She prepares a `CREATE` transaction... # She prepares a `CREATE` transaction...
prepared_creation_tx = bdb.transactions.prepare( prepared_creation_tx = bdb.transactions.prepare(
operation='CREATE', operation='CREATE',
signers=alice.public_key, signers=alice.public_key,
asset=bike) assets=bike)
# ... and she fulfills it with her private key. # ... and she fulfills it with her private key.
fulfilled_creation_tx = bdb.transactions.fulfill( fulfilled_creation_tx = bdb.transactions.fulfill(
@ -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',
asset=transfer_asset, assets=transfer_asset,
inputs=transfer_input, inputs=transfer_input,
recipients=bob.public_key) recipients=bob.public_key)

View File

@ -68,7 +68,7 @@ def test_divisible_assets():
operation='CREATE', operation='CREATE',
signers=alice.public_key, signers=alice.public_key,
recipients=[([bob.public_key], 10)], recipients=[([bob.public_key], 10)],
asset=bike_token) assets=bike_token)
# She fulfills and sends the transaction. # She fulfills and sends the transaction.
fulfilled_token_tx = bdb.transactions.fulfill( fulfilled_token_tx = bdb.transactions.fulfill(
@ -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',
asset=transfer_asset, assets=transfer_asset,
inputs=transfer_input, inputs=transfer_input,
recipients=[([alice.public_key], 3), ([bob.public_key], 7)]) recipients=[([alice.public_key], 3), ([bob.public_key], 7)])
@ -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',
asset=transfer_asset, assets=transfer_asset,
inputs=transfer_input, inputs=transfer_input,
recipients=[([alice.public_key], 8)]) recipients=[([alice.public_key], 8)])

View File

@ -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,
asset={'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):

View File

@ -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),
asset=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.
@ -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',
asset=transfer_asset, assets=transfer_asset,
inputs=transfer_input, inputs=transfer_input,
recipients=carol.public_key) recipients=carol.public_key)

View File

@ -32,7 +32,7 @@ naughty_strings = blns.all()
# This is our base test case, but we'll reuse it to send naughty strings as both keys and values. # This is our base test case, but we'll reuse it to send naughty strings as both keys and values.
def send_naughty_tx(asset, metadata): def send_naughty_tx(assets, metadata):
# ## Set up a connection to Planetmint # ## Set up a connection to Planetmint
# Check [test_basic.py](./test_basic.html) to get some more details # Check [test_basic.py](./test_basic.html) to get some more details
# about the endpoint. # about the endpoint.
@ -45,7 +45,7 @@ def send_naughty_tx(asset, metadata):
prepared_transaction = bdb.transactions.prepare( prepared_transaction = bdb.transactions.prepare(
operation='CREATE', operation='CREATE',
signers=alice.public_key, signers=alice.public_key,
asset=asset, assets=assets,
metadata=metadata) metadata=metadata)
# She fulfills the transaction # She fulfills the transaction
@ -86,16 +86,16 @@ def send_naughty_tx(asset, metadata):
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings) @pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
def test_naughty_keys(naughty_string): def test_naughty_keys(naughty_string):
asset = {'data': {naughty_string: 'nice_value'}} assets = [{'data': {naughty_string: 'nice_value'}}]
metadata = {naughty_string: 'nice_value'} metadata = {naughty_string: 'nice_value'}
send_naughty_tx(asset, metadata) send_naughty_tx(assets, metadata)
@pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings) @pytest.mark.parametrize("naughty_string", naughty_strings, ids=naughty_strings)
def test_naughty_values(naughty_string): def test_naughty_values(naughty_string):
asset = {'data': {'nice_key': naughty_string}} assets = [{'data': {'nice_key': naughty_string}}]
metadata = {'nice_key': naughty_string} metadata = {'nice_key': naughty_string}
send_naughty_tx(asset, metadata) send_naughty_tx(assets, metadata)

View File

@ -93,7 +93,7 @@ def test_stream():
bdb.transactions.prepare( bdb.transactions.prepare(
operation='CREATE', operation='CREATE',
signers=alice.public_key, signers=alice.public_key,
asset={'data': {'uuid': str(uuid4())}}), assets=[{'data': {'uuid': str(uuid4())}}]),
private_keys=alice.private_key) private_keys=alice.private_key)
# We don't want to wait for each transaction to be in a block. By using # We don't want to wait for each transaction to be in a block. By using
# `async` mode, we make sure that the driver returns as soon as the # `async` mode, we make sure that the driver returns as soon as the

View File

@ -58,7 +58,7 @@ condition_script_zencode, zenroom_data, zenroom_house_assets):
token_creation_tx = { token_creation_tx = {
'operation': 'CREATE', 'operation': 'CREATE',
'asset': zenroom_house_assets, 'assets': zenroom_house_assets,
'metadata': None, 'metadata': None,
'outputs': (output,), 'outputs': (output,),
'inputs': (input_,), 'inputs': (input_,),

View File

@ -4,7 +4,7 @@ Content-Type: application/json
{ {
"assets": "/assets/", "assets": "/assets/",
"blocks": "/blocks/", "blocks": "/blocks/",
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.0/http-client-server-api.html", "docs": "https://docs.planetmint.com/projects/server/en/v0.9.1/http-client-server-api.html",
"metadata": "/metadata/", "metadata": "/metadata/",
"outputs": "/outputs/", "outputs": "/outputs/",
"streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions",

View File

@ -5,15 +5,17 @@ Content-Type: application/json
"height": 1, "height": 1,
"transactions": [ "transactions": [
{ {
"asset": { "assets": [
"data": { {
"msg": "Hello Planetmint!" "data": {
"msg": "Hello Planetmint!"
}
} }
}, ],
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2", "id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac",
"inputs": [ "inputs": [
{ {
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUBcdRj6EnG3MPl47m3XPd1HNfe7q3WL4T6MewNNnat33UvzVnPHo_vossv57M7L064VwrYMLGp097H7IeHpDngK", "fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCWcUaLa2U-nkmZ6oYj14aeV6B4TJH2NvZ8k2ZTwcGiaiCGXDQT2dEPfMCFwM8lwSousafCu4c7EgVZ1GzUDjsN",
"fulfills": null, "fulfills": null,
"owners_before": [ "owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD" "4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"

View File

@ -1,3 +1,3 @@
GET /api/v1/blocks?transaction_id=6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2 HTTP/1.1 GET /api/v1/blocks?transaction_id=61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac HTTP/1.1
Host: example.com Host: example.com

View File

@ -1,3 +1,3 @@
GET /api/v1/transactions?operation=TRANSFER&asset_id=6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2 HTTP/1.1 GET /api/v1/transactions?operation=TRANSFER&asset_id=61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac HTTP/1.1
Host: example.com Host: example.com

View File

@ -2,16 +2,18 @@ HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
[{ [{
"asset": { "assets": [
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2" {
}, "id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac"
"id": "2bf8ae1e3bc889a26df129dd6bbe6ccab30d1ae8e9e434fae1c4446042a68931", }
],
"id": "b6e1ab3d48bbbbb0e40b952e70ec5d439b2745e0ba0c44b4ee877657e9ac33f0",
"inputs": [ "inputs": [
{ {
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUA90mMa9AWnbI70CUSVgzV9kRFf3tQ20RUIczNFqmwg9xrpOk_5uNoJB4bWRIojZmUhEyxSueCHLpqPXCEuyisE", "fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUA4BB4fxDXK3CQTbKpH5gTAN76NG-iopNuuDEfBbZ1Fl-ipNU46t8VCvK9ghm9Q53aFRW6DDiW5wcWXxY0sS4EJ",
"fulfills": { "fulfills": {
"output_index": 0, "output_index": 0,
"transaction_id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2" "transaction_id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac"
}, },
"owners_before": [ "owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD" "4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"
@ -40,16 +42,18 @@ Content-Type: application/json
"version": "2.0" "version": "2.0"
}, },
{ {
"asset": { "assets": [
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2" {
}, "id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac"
"id": "b9b614175eaed7cc93d9b80ebc2a91d35ae31928a7c218ae982272bb1785ef16", }
],
"id": "e43d3f93d90d22ef11c21607e3415bfcda4e0c7dd60412fbb55daf32978a3126",
"inputs": [ "inputs": [
{ {
"fulfillment": "pGSAICw7Ul-c2lG6NFbHp3FbKRC7fivQcNGO7GS4wV3A-1QggUDi2bAVKJgEyE3LzMrAnAu1PnNs9DbDNkABaY6j3OCNEVwNVNg3V3qELOFNnH8vGUevREr4E-8Vb1Kzk4VR71MO", "fulfillment": "pGSAICw7Ul-c2lG6NFbHp3FbKRC7fivQcNGO7GS4wV3A-1QggUBjj_XTjB3yJdG8JMNKnkkHvcX_BTOkl-YacRD4yKqxUCeL-VTgbrLgi5a3gGxNJcTkZP1gF0nsby8cgV4xmOcB",
"fulfills": { "fulfills": {
"output_index": 0, "output_index": 0,
"transaction_id": "2bf8ae1e3bc889a26df129dd6bbe6ccab30d1ae8e9e434fae1c4446042a68931" "transaction_id": "b6e1ab3d48bbbbb0e40b952e70ec5d439b2745e0ba0c44b4ee877657e9ac33f0"
}, },
"owners_before": [ "owners_before": [
"3yfQPHeWAa1MxTX9Zf9176QqcpcnWcanVZZbaHb8B3h9" "3yfQPHeWAa1MxTX9Zf9176QqcpcnWcanVZZbaHb8B3h9"

View File

@ -1,3 +1,3 @@
GET /api/v1/transactions/6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2 HTTP/1.1 GET /api/v1/transactions/61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac HTTP/1.1
Host: example.com Host: example.com

View File

@ -2,15 +2,17 @@ HTTP/1.1 200 OK
Content-Type: application/json Content-Type: application/json
{ {
"asset": { "assets": [
"data": { {
"msg": "Hello Planetmint!" "data": {
"msg": "Hello Planetmint!"
}
} }
}, ],
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2", "id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac",
"inputs": [ "inputs": [
{ {
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUBcdRj6EnG3MPl47m3XPd1HNfe7q3WL4T6MewNNnat33UvzVnPHo_vossv57M7L064VwrYMLGp097H7IeHpDngK", "fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCWcUaLa2U-nkmZ6oYj14aeV6B4TJH2NvZ8k2ZTwcGiaiCGXDQT2dEPfMCFwM8lwSousafCu4c7EgVZ1GzUDjsN",
"fulfills": null, "fulfills": null,
"owners_before": [ "owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD" "4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"

View File

@ -6,7 +6,7 @@ Content-Type: application/json
"v1": { "v1": {
"assets": "/api/v1/assets/", "assets": "/api/v1/assets/",
"blocks": "/api/v1/blocks/", "blocks": "/api/v1/blocks/",
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.0/http-client-server-api.html", "docs": "https://docs.planetmint.com/projects/server/en/v0.9.1/http-client-server-api.html",
"metadata": "/api/v1/metadata/", "metadata": "/api/v1/metadata/",
"outputs": "/api/v1/outputs/", "outputs": "/api/v1/outputs/",
"streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions",
@ -14,7 +14,7 @@ Content-Type: application/json
"validators": "/api/v1/validators" "validators": "/api/v1/validators"
} }
}, },
"docs": "https://docs.planetmint.com/projects/server/en/v0.9.0/", "docs": "https://docs.planetmint.com/projects/server/en/v0.9.1/",
"software": "Planetmint", "software": "Planetmint",
"version": "0.9.0" "version": "0.9.1"
} }

View File

@ -3,15 +3,17 @@ Host: example.com
Content-Type: application/json Content-Type: application/json
{ {
"asset": { "assets": [
"data": { {
"msg": "Hello Planetmint!" "data": {
"msg": "Hello Planetmint!"
}
} }
}, ],
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2", "id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac",
"inputs": [ "inputs": [
{ {
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUBcdRj6EnG3MPl47m3XPd1HNfe7q3WL4T6MewNNnat33UvzVnPHo_vossv57M7L064VwrYMLGp097H7IeHpDngK", "fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCWcUaLa2U-nkmZ6oYj14aeV6B4TJH2NvZ8k2ZTwcGiaiCGXDQT2dEPfMCFwM8lwSousafCu4c7EgVZ1GzUDjsN",
"fulfills": null, "fulfills": null,
"owners_before": [ "owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD" "4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"

View File

@ -2,15 +2,17 @@ HTTP/1.1 202 Accepted
Content-Type: application/json Content-Type: application/json
{ {
"asset": { "assets": [
"data": { {
"msg": "Hello Planetmint!" "data": {
"msg": "Hello Planetmint!"
}
} }
}, ],
"id": "6438c733f53dff60bdeded80e8c95126dd3a7ce8c1ee5d5591d030e61cde35d2", "id": "61e1312b80705e0dabb948c9d78dae7f62d64832abda822b13d89c4a7305d4ac",
"inputs": [ "inputs": [
{ {
"fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUBcdRj6EnG3MPl47m3XPd1HNfe7q3WL4T6MewNNnat33UvzVnPHo_vossv57M7L064VwrYMLGp097H7IeHpDngK", "fulfillment": "pGSAIDE5i63cn4X8T8N1sZ2mGkJD5lNRnBM4PZgI_zvzbr-cgUCWcUaLa2U-nkmZ6oYj14aeV6B4TJH2NvZ8k2ZTwcGiaiCGXDQT2dEPfMCFwM8lwSousafCu4c7EgVZ1GzUDjsN",
"fulfills": null, "fulfills": null,
"owners_before": [ "owners_before": [
"4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD" "4K9sWUMFwTgaDGPfdynrbxWqWS6sWmKbZoTjxLtVUibD"