mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
update docs/test file to avoid conflicts between testcases
This commit is contained in:
parent
2b34c939b2
commit
eab54e1a02
@ -324,8 +324,8 @@ tx_multisig_transfer_signed = b.sign_transaction(tx_multisig_transfer, [testuser
|
|||||||
b.write_transaction(tx_multisig_transfer_signed)
|
b.write_transaction(tx_multisig_transfer_signed)
|
||||||
|
|
||||||
# Check if the transaction is already in the bigchain
|
# Check if the transaction is already in the bigchain
|
||||||
tx_multisig_retrieved = b.get_transaction(tx_multisig_transfer_signed['id'])
|
tx_multisig_transfer_retrieved = b.get_transaction(tx_multisig_transfer_signed['id'])
|
||||||
tx_multisig_retrieved
|
tx_multisig_transfer_retrieved
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
@ -29,7 +29,7 @@ tx_signed = b.sign_transaction(tx, b.me_private)
|
|||||||
# included in a block, and written to the bigchain
|
# included in a block, and written to the bigchain
|
||||||
b.write_transaction(tx_signed)
|
b.write_transaction(tx_signed)
|
||||||
|
|
||||||
sleep(10)
|
sleep(8)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Read the Creation Transaction from the DB
|
Read the Creation Transaction from the DB
|
||||||
@ -61,10 +61,12 @@ tx_transfer = b.create_transaction(testuser1_pub, testuser2_pub, tx_retrieved_id
|
|||||||
# sign the transaction
|
# sign the transaction
|
||||||
tx_transfer_signed = b.sign_transaction(tx_transfer, testuser1_priv)
|
tx_transfer_signed = b.sign_transaction(tx_transfer, testuser1_priv)
|
||||||
|
|
||||||
|
|
||||||
|
b.validate_transaction(tx_transfer_signed)
|
||||||
# write the transaction
|
# write the transaction
|
||||||
b.write_transaction(tx_transfer_signed)
|
b.write_transaction(tx_transfer_signed)
|
||||||
|
|
||||||
sleep(10)
|
sleep(8)
|
||||||
|
|
||||||
# check if the transaction is already in the bigchain
|
# check if the transaction is already in the bigchain
|
||||||
tx_transfer_retrieved = b.get_transaction(tx_transfer_signed['id'])
|
tx_transfer_retrieved = b.get_transaction(tx_transfer_signed['id'])
|
||||||
@ -95,10 +97,12 @@ tx_multisig = b.create_transaction(b.me, [testuser1_pub, testuser2_pub], None, '
|
|||||||
|
|
||||||
# Have the federation sign the transaction
|
# Have the federation sign the transaction
|
||||||
tx_multisig_signed = b.sign_transaction(tx_multisig, b.me_private)
|
tx_multisig_signed = b.sign_transaction(tx_multisig, b.me_private)
|
||||||
|
|
||||||
|
b.validate_transaction(tx_multisig_signed)
|
||||||
b.write_transaction(tx_multisig_signed)
|
b.write_transaction(tx_multisig_signed)
|
||||||
|
|
||||||
# wait a few seconds for the asset to appear on the blockchain
|
# wait a few seconds for the asset to appear on the blockchain
|
||||||
sleep(10)
|
sleep(8)
|
||||||
|
|
||||||
# retrieve the transaction
|
# retrieve the transaction
|
||||||
tx_multisig_retrieved = b.get_transaction(tx_multisig_signed['id'])
|
tx_multisig_retrieved = b.get_transaction(tx_multisig_signed['id'])
|
||||||
@ -111,15 +115,16 @@ tx_multisig_retrieved_id = b.get_owned_ids(testuser2_pub).pop()
|
|||||||
tx_multisig_transfer = b.create_transaction([testuser1_pub, testuser2_pub], testuser3_pub, tx_multisig_retrieved_id, 'TRANSFER')
|
tx_multisig_transfer = b.create_transaction([testuser1_pub, testuser2_pub], testuser3_pub, tx_multisig_retrieved_id, 'TRANSFER')
|
||||||
tx_multisig_transfer_signed = b.sign_transaction(tx_multisig_transfer, [testuser1_priv, testuser2_priv])
|
tx_multisig_transfer_signed = b.sign_transaction(tx_multisig_transfer, [testuser1_priv, testuser2_priv])
|
||||||
|
|
||||||
|
b.validate_transaction(tx_multisig_transfer_signed)
|
||||||
b.write_transaction(tx_multisig_transfer_signed)
|
b.write_transaction(tx_multisig_transfer_signed)
|
||||||
|
|
||||||
# wait a few seconds for the asset to appear on the blockchain
|
# wait a few seconds for the asset to appear on the blockchain
|
||||||
sleep(10)
|
sleep(8)
|
||||||
|
|
||||||
# retrieve the transaction
|
# retrieve the transaction
|
||||||
tx_multisig_retrieved = b.get_transaction(tx_multisig_transfer_signed['id'])
|
tx_multisig_transfer_retrieved = b.get_transaction(tx_multisig_transfer_signed['id'])
|
||||||
|
assert tx_multisig_transfer_retrieved is not None
|
||||||
print(json.dumps(tx_multisig_transfer_signed, sort_keys=True, indent=4, separators=(',', ':')))
|
print(json.dumps(tx_multisig_transfer_retrieved, sort_keys=True, indent=4, separators=(',', ':')))
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Multiple Inputs and Outputs
|
Multiple Inputs and Outputs
|
||||||
@ -127,9 +132,10 @@ Multiple Inputs and Outputs
|
|||||||
for i in range(3):
|
for i in range(3):
|
||||||
tx_mimo_asset = b.create_transaction(b.me, testuser1_pub, None, 'CREATE')
|
tx_mimo_asset = b.create_transaction(b.me, testuser1_pub, None, 'CREATE')
|
||||||
tx_mimo_asset_signed = b.sign_transaction(tx_mimo_asset, b.me_private)
|
tx_mimo_asset_signed = b.sign_transaction(tx_mimo_asset, b.me_private)
|
||||||
|
b.validate_transaction(tx_mimo_asset_signed)
|
||||||
b.write_transaction(tx_mimo_asset_signed)
|
b.write_transaction(tx_mimo_asset_signed)
|
||||||
|
|
||||||
sleep(10)
|
sleep(8)
|
||||||
|
|
||||||
# get inputs
|
# get inputs
|
||||||
owned_mimo_inputs = b.get_owned_ids(testuser1_pub)
|
owned_mimo_inputs = b.get_owned_ids(testuser1_pub)
|
||||||
@ -137,9 +143,10 @@ print(len(owned_mimo_inputs))
|
|||||||
|
|
||||||
# create a transaction
|
# create a transaction
|
||||||
tx_mimo = b.create_transaction(testuser1_pub, testuser2_pub, owned_mimo_inputs, 'TRANSFER')
|
tx_mimo = b.create_transaction(testuser1_pub, testuser2_pub, owned_mimo_inputs, 'TRANSFER')
|
||||||
tx_mimo_signed = b.sign_transaction(tx_mimo, testuser1_priv)
|
|
||||||
|
|
||||||
|
tx_mimo_signed = b.sign_transaction(tx_mimo, testuser1_priv)
|
||||||
# write the transaction
|
# write the transaction
|
||||||
|
b.validate_transaction(tx_mimo_signed)
|
||||||
b.write_transaction(tx_mimo_signed)
|
b.write_transaction(tx_mimo_signed)
|
||||||
|
|
||||||
print(json.dumps(tx_mimo_signed, sort_keys=True, indent=4, separators=(',', ':')))
|
print(json.dumps(tx_mimo_signed, sort_keys=True, indent=4, separators=(',', ':')))
|
||||||
@ -178,10 +185,11 @@ threshold_tx['id'] = util.get_hash_data(threshold_tx)
|
|||||||
# sign the transaction
|
# sign the transaction
|
||||||
threshold_tx_signed = b.sign_transaction(threshold_tx, testuser2_priv)
|
threshold_tx_signed = b.sign_transaction(threshold_tx, testuser2_priv)
|
||||||
|
|
||||||
|
b.validate_transaction(threshold_tx_signed)
|
||||||
# write the transaction
|
# write the transaction
|
||||||
b.write_transaction(threshold_tx_signed)
|
b.write_transaction(threshold_tx_signed)
|
||||||
|
|
||||||
sleep(10)
|
sleep(8)
|
||||||
|
|
||||||
# check if the transaction is already in the bigchain
|
# check if the transaction is already in the bigchain
|
||||||
tx_threshold_retrieved = b.get_transaction(threshold_tx_signed['id'])
|
tx_threshold_retrieved = b.get_transaction(threshold_tx_signed['id'])
|
||||||
@ -266,7 +274,7 @@ assert b.is_valid_transaction(hashlock_tx_signed) == hashlock_tx_signed
|
|||||||
b.write_transaction(hashlock_tx_signed)
|
b.write_transaction(hashlock_tx_signed)
|
||||||
print(json.dumps(hashlock_tx_signed, sort_keys=True, indent=4, separators=(',', ':')))
|
print(json.dumps(hashlock_tx_signed, sort_keys=True, indent=4, separators=(',', ':')))
|
||||||
|
|
||||||
sleep(10)
|
sleep(8)
|
||||||
|
|
||||||
hashlockuser_priv, hashlockuser_pub = crypto.generate_key_pair()
|
hashlockuser_priv, hashlockuser_pub = crypto.generate_key_pair()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user