def test_transaction_fees(): responses.add( responses.GET, 'http://127.0.0.1:4002/transactions/fees', json={ 'data': { 'dynamic': False, 'transfer': 10000000, 'secondSignature': 500000000, 'delegateRegistration': 2500000000, 'vote': 100000000, 'multiSignature': 500000000, 'ipfs': 0, 'timelockTransfer': 0, 'multiPayment': 0, 'delegateResignation': 0 } }, status=200 ) client = ArkClient('http://127.0.0.1:4002') client.transactions.fees() assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith('http://127.0.0.1:4002/transactions/fees')
def test_fees_calls_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/node/fees', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.node.fees() assert len(responses.calls) == 1 assert responses.calls[0].request.url == 'http://127.0.0.1:4002/node/fees'
def test_all_unconfirmed_calls_correct_url_with_default_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/transactions/unconfirmed', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.transactions.all_unconfirmed() assert len(responses.calls) == 1 assert responses.calls[0].request.url == ( 'http://127.0.0.1:4002/transactions/unconfirmed?limit=100')
def test_top_calls_correct_url_with_default_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/accounts/top', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.accounts.top() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/accounts/top?limit=20'
def test_all_calls_correct_url_with_default_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/transactions', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v2') client.transactions.all() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/transactions?limit=20'
def test_all_calls_correct_url_with_default_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/blocks', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.blocks.all() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/blocks?limit=100'
def test_configuration_crypto_call_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/node/configuration/crypto', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.node.crypto() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/node/configuration/crypto'
def test_get_correct_url_with_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/accounts', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.accounts.get(address='spongebob') assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/accounts?address=spongebob'
def test_syncing_calls_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/node/syncing', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v2') client.node.syncing() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/node/syncing'
def test_delegates_fee_calls_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/accounts/delegates/fee', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.accounts.delegates_fee() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/accounts/delegates/fee'
def test_get_calls_correct_url_with_passed_in_param(): responses.add(responses.GET, 'http://127.0.0.1:4002/transactions/get', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.transactions.get('my-transaction') assert len(responses.calls) == 1 assert responses.calls[0].request.url == ( 'http://127.0.0.1:4002/transactions/get?id=my-transaction')
def test_fees_calls_correct_url_with_passed_in_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/node/fees', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.node.fees(days=14) assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith( 'http://127.0.0.1:4002/node/fees?') assert 'days=14' in responses.calls[0].request.url
def test_next_forgers_calls_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/delegates/getNextForgers', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.delegates.next_forgers() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/delegates/getNextForgers'
def test_autoconfigure_calls_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/loader/autoconfigure', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.loader.autoconfigure() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/loader/autoconfigure'
def test_fee_calls_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/blocks/getFee', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.blocks.fee() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/blocks/getFee'
def test_get_calls_correct_url_with_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/blocks/get', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.blocks.get('spongebob') assert len(responses.calls) == 1 assert responses.calls[0].request.url == ( 'http://127.0.0.1:4002/blocks/get?id=spongebob')
def test_votes_calls_correct_url_with_default_params(): wallet_id = '12345' responses.add(responses.GET, 'http://127.0.0.1:4002/wallets/{}/votes'.format(wallet_id), json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v2') client.wallets.votes(wallet_id) assert len(responses.calls) == 1 assert responses.calls[0].request.url == ( 'http://127.0.0.1:4002/wallets/12345/votes?limit=20')
def test_version_calls_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/peers/version', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.peers.version() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/peers/version'
def test_get_calls_correct_url_with_passed_in_username(): responses.add(responses.GET, 'http://127.0.0.1:4002/delegates/get', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.delegates.get(username='******') assert len(responses.calls) == 1 assert responses.calls[0].request.url == ( 'http://127.0.0.1:4002/delegates/get?username=my-username')
def test_last_calls_correct_url(): responses.add(responses.GET, 'http://127.0.0.1:4002/blocks/last', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.blocks.last() assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/blocks/last'
def test_get_calls_correct_url_with_ip(): ip = '123.4.5.67' responses.add(responses.GET, 'http://127.0.0.1:4002/peers/{}'.format(ip), json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v2') client.peers.get(ip) assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/peers/123.4.5.67'
def test_all_calls_correct_url_with_passed_in_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/peers', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v1') client.peers.all(limit=69, offset=123) assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith( 'http://127.0.0.1:4002/peers?') assert 'limit=69' in responses.calls[0].request.url assert 'offset=123' in responses.calls[0].request.url
def test_search_calls_correct_url_with_default_params(): responses.add( responses.POST, 'http://127.0.0.1:4002/transactions/search', json={'success': True}, status=200 ) client = ArkClient('http://127.0.0.1:4002') client.transactions.search({'blockId': '1337'}) assert len(responses.calls) == 1 assert responses.calls[0].request.url == 'http://127.0.0.1:4002/transactions/search?limit=100' assert json.loads(responses.calls[0].request.body.decode()) == {'blockId': '1337'}
def test_transactions_calls_correct_url_with_default_params(): block_id = '12345' responses.add( responses.GET, 'http://127.0.0.1:4002/blocks/{}/transactions'.format(block_id), json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.blocks.transactions(block_id) assert len(responses.calls) == 1 assert responses.calls[0].request.url == ( 'http://127.0.0.1:4002/blocks/12345/transactions?limit=100')
def test_all_unconfirmed_calls_correct_url_with_passed_in_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/transactions/unconfirmed', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002', api_version='v2') client.transactions.all_unconfirmed(offset=5, limit=69) assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith( 'http://127.0.0.1:4002/transactions/unconfirmed?') assert 'offset=5' in responses.calls[0].request.url assert 'limit=69' in responses.calls[0].request.url
def test_get_calls_correct_url(): block_id = '12345' responses.add(responses.GET, 'http://127.0.0.1:4002/blocks/{}'.format(block_id), json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.blocks.get(block_id) assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/blocks/12345'
def test_all_calls_correct_url_with_passed_in_params(): responses.add(responses.GET, 'http://127.0.0.1:4002/blocks', json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.blocks.all(page=5, limit=69) assert len(responses.calls) == 1 assert responses.calls[0].request.url.startswith( 'http://127.0.0.1:4002/blocks?') assert 'page=5' in responses.calls[0].request.url assert 'limit=69' in responses.calls[0].request.url
def test_search_calls_correct_url_with_default_params(): responses.add( responses.POST, 'http://127.0.0.1:4002/delegates/search', json={'success': True}, status=200 ) client = ArkClient('http://127.0.0.1:4002') client.delegates.search('deadlock') assert len(responses.calls) == 1 assert responses.calls[0].request.url == 'http://127.0.0.1:4002/delegates/search?limit=100' assert json.loads(responses.calls[0].request.body.decode()) == {'username': '******'}
def test_delegates_calls_correct_url(): round_id = '12345' responses.add(responses.GET, 'http://127.0.0.1:4002/rounds/{}/delegates'.format(round_id), json={'success': True}, status=200) client = ArkClient('http://127.0.0.1:4002') client.rounds.delegates(round_id) assert len(responses.calls) == 1 assert responses.calls[ 0].request.url == 'http://127.0.0.1:4002/rounds/12345/delegates'
def test_search_calls_correct_url_with_default_params(): responses.add( responses.POST, 'http://127.0.0.1:4002/wallets/search', json={'success': True}, status=200 ) client = ArkClient('http://127.0.0.1:4002', api_version='v2') client.wallets.search({'address': 'my-address'}) assert len(responses.calls) == 1 assert responses.calls[0].request.url == 'http://127.0.0.1:4002/wallets/search?limit=20' assert json.loads(responses.calls[0].request.body.decode()) == {'address': 'my-address'}