Пример #1
0
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')
Пример #2
0
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')
Пример #4
0
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'
Пример #6
0
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'
Пример #7
0
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'
Пример #8
0
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'
Пример #9
0
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'
Пример #10
0
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'
Пример #11
0
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')
Пример #12
0
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
Пример #13
0
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'
Пример #14
0
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'
Пример #15
0
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'
Пример #16
0
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')
Пример #17
0
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')
Пример #18
0
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'
Пример #19
0
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')
Пример #20
0
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'
Пример #21
0
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'
Пример #22
0
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
Пример #23
0
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'}
Пример #24
0
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
Пример #26
0
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'
Пример #27
0
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
Пример #28
0
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': '******'}
Пример #29
0
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'
Пример #30
0
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'}