2018-08-16 12:31:32 +02:00
|
|
|
# Copyright BigchainDB GmbH and BigchainDB contributors
|
|
|
|
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
|
|
|
# Code is Apache-2.0 and docs are CC-BY-4.0
|
|
|
|
|
2017-01-06 14:18:10 +01:00
|
|
|
from unittest import mock
|
|
|
|
|
|
|
|
|
2017-01-06 14:45:38 +01:00
|
|
|
@mock.patch('bigchaindb.version.__short_version__', 'tst')
|
|
|
|
@mock.patch('bigchaindb.version.__version__', 'tsttst')
|
2017-06-28 11:39:50 +02:00
|
|
|
def test_api_root_endpoint(client, wsserver_base_url):
|
2016-11-15 11:53:41 +01:00
|
|
|
res = client.get('/')
|
2017-06-14 11:09:42 +02:00
|
|
|
docs_url = ['https://docs.bigchaindb.com/projects/server/en/vtsttst',
|
|
|
|
'/http-client-server-api.html']
|
2017-01-06 14:45:38 +01:00
|
|
|
assert res.json == {
|
2017-06-12 15:13:42 +02:00
|
|
|
'api': {
|
2017-06-14 11:09:42 +02:00
|
|
|
'v1': {
|
|
|
|
'docs': ''.join(docs_url),
|
|
|
|
'transactions': '/api/v1/transactions/',
|
|
|
|
'assets': '/api/v1/assets/',
|
|
|
|
'outputs': '/api/v1/outputs/',
|
2017-06-28 11:39:50 +02:00
|
|
|
'streams': '{}/api/v1/streams/valid_transactions'.format(
|
|
|
|
wsserver_base_url),
|
2017-11-27 16:22:33 +01:00
|
|
|
'metadata': '/api/v1/metadata/',
|
2018-02-27 09:01:44 +01:00
|
|
|
'validators': '/api/v1/validators',
|
2017-06-14 11:09:42 +02:00
|
|
|
}
|
2017-01-06 14:45:38 +01:00
|
|
|
},
|
2017-06-12 15:13:42 +02:00
|
|
|
'docs': 'https://docs.bigchaindb.com/projects/server/en/vtsttst/',
|
2017-01-06 14:45:38 +01:00
|
|
|
'version': 'tsttst',
|
|
|
|
'software': 'BigchainDB',
|
|
|
|
}
|
2017-01-06 14:18:10 +01:00
|
|
|
|
|
|
|
|
2017-01-06 14:45:38 +01:00
|
|
|
@mock.patch('bigchaindb.version.__short_version__', 'tst')
|
2017-02-09 11:10:58 +01:00
|
|
|
@mock.patch('bigchaindb.version.__version__', 'tsttst')
|
2017-06-28 11:39:50 +02:00
|
|
|
def test_api_v1_endpoint(client, wsserver_base_url):
|
2017-06-14 11:09:42 +02:00
|
|
|
docs_url = ['https://docs.bigchaindb.com/projects/server/en/vtsttst',
|
|
|
|
'/http-client-server-api.html']
|
|
|
|
api_v1_info = {
|
|
|
|
'docs': ''.join(docs_url),
|
|
|
|
'transactions': '/transactions/',
|
|
|
|
'assets': '/assets/',
|
|
|
|
'outputs': '/outputs/',
|
2017-06-28 11:39:50 +02:00
|
|
|
'streams': '{}/api/v1/streams/valid_transactions'.format(
|
|
|
|
wsserver_base_url),
|
2017-11-27 16:22:33 +01:00
|
|
|
'metadata': '/metadata/',
|
2018-09-10 09:53:18 +02:00
|
|
|
'validators': '/validators'
|
2017-06-14 11:09:42 +02:00
|
|
|
}
|
2017-01-06 14:45:38 +01:00
|
|
|
res = client.get('/api/v1')
|
2017-06-12 15:13:42 +02:00
|
|
|
assert res.json == api_v1_info
|