From 7af997508141d7281ae6247a4b3a12ace688bbd5 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Wed, 25 Jan 2017 12:22:34 +0100 Subject: [PATCH] return 202 on successful transaction POST --- bigchaindb/web/views/transactions.py | 2 +- tests/web/test_transactions.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bigchaindb/web/views/transactions.py b/bigchaindb/web/views/transactions.py index 3059b34f..a4a983ef 100644 --- a/bigchaindb/web/views/transactions.py +++ b/bigchaindb/web/views/transactions.py @@ -113,4 +113,4 @@ class TransactionListApi(Resource): with monitor.timer('write_transaction', rate=rate): bigchain.write_transaction(tx_obj) - return tx + return tx, 202 diff --git a/tests/web/test_transactions.py b/tests/web/test_transactions.py index 28e0fab0..6970c725 100644 --- a/tests/web/test_transactions.py +++ b/tests/web/test_transactions.py @@ -38,6 +38,9 @@ def test_post_create_transaction_endpoint(b, client): tx = tx.sign([user_priv]) res = client.post(TX_ENDPOINT, data=json.dumps(tx.to_dict())) + + assert res.status_code == 202 + assert res.json['inputs'][0]['owners_before'][0] == user_pub assert res.json['outputs'][0]['public_keys'][0] == user_pub @@ -157,6 +160,8 @@ def test_post_transfer_transaction_endpoint(b, client, user_pk, user_sk): res = client.post(TX_ENDPOINT, data=json.dumps(transfer_tx.to_dict())) + assert res.status_code == 202 + assert res.json['inputs'][0]['owners_before'][0] == user_pk assert res.json['outputs'][0]['public_keys'][0] == user_pub