mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00

* Problem: BigchainDB config has stale/deprecated parameters - Remove `keyring` and `keypair` from config - Update tests - Add `tendermint` config * Fix flake8 * Update some naming conventions and redundant changes * Remove redundant routine `fast_query` * Remove deprecated parameters and descriptions * remove some more unwanted code * Problem: Two flake8 errors made Travis fail Solution: Fix the two flake8 errors * Address comments - Remove reference of nodes_except_me and me_private and me as attributes of BigchainDB instances - Update and re-add test(s) - Do not introduce `tendermint` in configuration instead handle that in a separate PR along with docs * Address comments - Remove tests that are already covered with 2.0 - Remove tests that are no longer relevant - Add TODO for more cleanup * Remove tendermint config from configure command
53 lines
1.5 KiB
Python
53 lines
1.5 KiB
Python
import pytest
|
|
|
|
BLOCKS_ENDPOINT = '/api/v1/blocks/'
|
|
|
|
|
|
@pytest.mark.bdb
|
|
@pytest.mark.usefixtures('inputs')
|
|
def test_get_block_returns_404_if_not_found(client):
|
|
res = client.get(BLOCKS_ENDPOINT + '123')
|
|
assert res.status_code == 404
|
|
|
|
res = client.get(BLOCKS_ENDPOINT + '123/')
|
|
assert res.status_code == 404
|
|
|
|
|
|
@pytest.mark.bdb
|
|
def test_get_blocks_by_txid_endpoint_returns_empty_list_not_found(client):
|
|
res = client.get(BLOCKS_ENDPOINT + '?transaction_id=')
|
|
assert res.status_code == 200
|
|
assert len(res.json) == 0
|
|
|
|
res = client.get(BLOCKS_ENDPOINT + '?transaction_id=123')
|
|
assert res.status_code == 200
|
|
assert len(res.json) == 0
|
|
|
|
|
|
@pytest.mark.bdb
|
|
def test_get_blocks_by_txid_endpoint_returns_400_bad_query_params(client):
|
|
res = client.get(BLOCKS_ENDPOINT)
|
|
assert res.status_code == 400
|
|
|
|
res = client.get(BLOCKS_ENDPOINT + '?ts_id=123')
|
|
assert res.status_code == 400
|
|
assert res.json == {
|
|
'message': {
|
|
'transaction_id': 'Missing required parameter in the JSON body or the post body or the query string'
|
|
}
|
|
}
|
|
|
|
res = client.get(BLOCKS_ENDPOINT + '?transaction_id=123&foo=123')
|
|
assert res.status_code == 400
|
|
assert res.json == {
|
|
'message': 'Unknown arguments: foo'
|
|
}
|
|
|
|
res = client.get(BLOCKS_ENDPOINT + '?transaction_id=123&status=123')
|
|
assert res.status_code == 400
|
|
assert res.json == {
|
|
'message': {
|
|
'status': '123 is not a valid choice'
|
|
}
|
|
}
|