Problem: send function has a deprecation warning in the driver

Solution: replace send with the matching new functions
This commit is contained in:
codegeschrei 2018-09-17 10:56:06 +02:00
parent 3cb0f8e2ab
commit bda2065bfb
6 changed files with 10 additions and 12 deletions

View File

@ -61,7 +61,7 @@ def test_basic():
bike_id = fulfilled_creation_tx['id'] bike_id = fulfilled_creation_tx['id']
# Now she is ready to send it to the BigchainDB Network. # Now she is ready to send it to the BigchainDB Network.
sent_transfer_tx = bdb.transactions.send(fulfilled_creation_tx) sent_transfer_tx = bdb.transactions.send_commit(fulfilled_creation_tx)
# And just to be 100% sure, she also checks if she can retrieve # And just to be 100% sure, she also checks if she can retrieve
# it from the BigchainDB node. # it from the BigchainDB node.
@ -107,7 +107,7 @@ def test_basic():
private_keys=alice.private_key) private_keys=alice.private_key)
# She finally sends the transaction to a BigchainDB node. # She finally sends the transaction to a BigchainDB node.
sent_transfer_tx = bdb.transactions.send(fulfilled_transfer_tx) sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
# And just to be 100% sure, she also checks if she can retrieve # And just to be 100% sure, she also checks if she can retrieve
# it from the BigchainDB node. # it from the BigchainDB node.

View File

@ -74,7 +74,7 @@ def test_divisible_assets():
prepared_token_tx, prepared_token_tx,
private_keys=alice.private_key) private_keys=alice.private_key)
bdb.transactions.send(fulfilled_token_tx, mode='commit') bdb.transactions.send_commit(fulfilled_token_tx)
# We store the `id` of the transaction to use it later on. # We store the `id` of the transaction to use it later on.
bike_token_id = fulfilled_token_tx['id'] bike_token_id = fulfilled_token_tx['id']
@ -116,8 +116,7 @@ def test_divisible_assets():
prepared_transfer_tx, prepared_transfer_tx,
private_keys=bob.private_key) private_keys=bob.private_key)
sent_transfer_tx = bdb.transactions.send(fulfilled_transfer_tx, sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
mode='commit')
# First, Bob checks if the transaction was successful. # First, Bob checks if the transaction was successful.
assert bdb.transactions.retrieve( assert bdb.transactions.retrieve(
@ -167,7 +166,7 @@ def test_divisible_assets():
# Remember Bob, last time you spent 3 tokens already, # Remember Bob, last time you spent 3 tokens already,
# so you only have 7 left. # so you only have 7 left.
with pytest.raises(BadRequest) as error: with pytest.raises(BadRequest) as error:
bdb.transactions.send(fulfilled_transfer_tx, mode='commit') bdb.transactions.send_commit(fulfilled_transfer_tx)
# Now Bob gets an error saying that the amount he wanted to spent is # Now Bob gets an error saying that the amount he wanted to spent is
# higher than the amount of tokens he has left. # higher than the amount of tokens he has left.

View File

@ -30,7 +30,7 @@ def test_double_create():
def send_and_queue(tx): def send_and_queue(tx):
try: try:
bdb.transactions.send(tx) bdb.transactions.send_commit(tx)
results.put('OK') results.put('OK')
except bigchaindb_driver.exceptions.TransportError as e: except bigchaindb_driver.exceptions.TransportError as e:
results.put('FAIL') results.put('FAIL')

View File

@ -64,7 +64,7 @@ def test_multiple_owners():
prepared_dw_tx, prepared_dw_tx,
private_keys=[alice.private_key, bob.private_key]) private_keys=[alice.private_key, bob.private_key])
bdb.transactions.send(fulfilled_dw_tx, mode='commit') bdb.transactions.send_commit(fulfilled_dw_tx)
# We store the `id` of the transaction to use it later on. # We store the `id` of the transaction to use it later on.
dw_id = fulfilled_dw_tx['id'] dw_id = fulfilled_dw_tx['id']
@ -109,8 +109,7 @@ def test_multiple_owners():
prepared_transfer_tx, prepared_transfer_tx,
private_keys=[alice.private_key, bob.private_key]) private_keys=[alice.private_key, bob.private_key])
sent_transfer_tx = bdb.transactions.send(fulfilled_transfer_tx, sent_transfer_tx = bdb.transactions.send_commit(fulfilled_transfer_tx)
mode='commit')
# They check if the transaction was successful. # They check if the transaction was successful.
assert bdb.transactions.retrieve( assert bdb.transactions.retrieve(

View File

@ -54,7 +54,7 @@ def send_naughty_tx(asset, metadata):
# The fulfilled tx gets sent to the BDB network # The fulfilled tx gets sent to the BDB network
try: try:
sent_transaction = bdb.transactions.send(fulfilled_transaction) sent_transaction = bdb.transactions.send_commit(fulfilled_transaction)
except BadRequest as e: except BadRequest as e:
sent_transaction = e sent_transaction = e

View File

@ -100,7 +100,7 @@ def test_stream():
# transactions to be in the shared queue: this is a two phase test, # transactions to be in the shared queue: this is a two phase test,
# first we send a bunch of transactions, then we check if they are # first we send a bunch of transactions, then we check if they are
# valid (and, in this case, they should). # valid (and, in this case, they should).
bdb.transactions.send(tx, mode='async') bdb.transactions.send_async(tx)
# The `id` of every sent transaction is then stored in a list. # The `id` of every sent transaction is then stored in a list.
sent.append(tx['id']) sent.append(tx['id'])