mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
requested changes
This commit is contained in:
parent
b7d235379a
commit
411d1963bb
@ -41,10 +41,9 @@ class BigchainDB(Bigchain):
|
|||||||
# TODO: handle connection errors!
|
# TODO: handle connection errors!
|
||||||
requests.post(ENDPOINT, json=payload)
|
requests.post(ENDPOINT, json=payload)
|
||||||
|
|
||||||
def write_transaction(self, transaction, **kwargs):
|
def write_transaction(self, transaction, **mode):
|
||||||
# This method offers backward compatibility with the Web API.
|
# This method offers backward compatibility with the Web API.
|
||||||
"""Submit a valid transaction to the mempool."""
|
"""Submit a valid transaction to the mempool."""
|
||||||
mode = kwargs
|
|
||||||
self.post_transaction(transaction, mode)
|
self.post_transaction(transaction, mode)
|
||||||
|
|
||||||
def store_transaction(self, transaction):
|
def store_transaction(self, transaction):
|
||||||
|
@ -56,10 +56,9 @@ class TransactionListApi(Resource):
|
|||||||
A ``dict`` containing the data about the transaction.
|
A ``dict`` containing the data about the transaction.
|
||||||
"""
|
"""
|
||||||
parser = reqparse.RequestParser()
|
parser = reqparse.RequestParser()
|
||||||
parser.add_argument('mode', type=parameters.valid_mode)
|
parser.add_argument('mode', type=parameters.valid_mode,
|
||||||
|
default='broadcast_tx_async')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if not str(args['mode']) or str(args['mode']) == 'None':
|
|
||||||
args['mode'] = 'broadcast_tx_async'
|
|
||||||
|
|
||||||
pool = current_app.config['bigchain_pool']
|
pool = current_app.config['bigchain_pool']
|
||||||
|
|
||||||
|
@ -446,3 +446,5 @@ def test_post_transaction_invalid_mode(client):
|
|||||||
mode_endpoint = TX_ENDPOINT + '?mode=nope'
|
mode_endpoint = TX_ENDPOINT + '?mode=nope'
|
||||||
response = client.post(mode_endpoint, data=json.dumps(tx.to_dict()))
|
response = client.post(mode_endpoint, data=json.dumps(tx.to_dict()))
|
||||||
assert '400 BAD REQUEST' in response.status
|
assert '400 BAD REQUEST' in response.status
|
||||||
|
assert 'Mode must be "async", "sync" or "commit"' ==\
|
||||||
|
json.loads(response.data.decode('utf8'))['message']['mode']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user