def test_get_addresses_details(self):
        addresses_details = get_addresses_details(
                address_list=[
                    # 2 of the first used BTC addresses
                    '1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1',
                    '1FvzCLoTPGANNjWoUo6jUGuAG3wg1w4YjR',
                    ],
                coin_symbol='btc',
                txn_limit=None,
                api_key=BC_API_KEY,
                # This way the test result never changes:
                before_bh=4,
                )

        assert len(addresses_details) == 2

        for addr_obj in addresses_details:
            address = addr_obj.get('address')
            if address == '1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1':
                assert len(addr_obj['txrefs']) == 1
                assert addr_obj['txrefs'][0]['tx_hash'] == '9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5'
                assert addr_obj['txrefs'][0]['block_height'] == 2
                assert addr_obj['txrefs'][0]['confirmed'] is not None
                assert addr_obj['txrefs'][0]['tx_input_n'] == -1
                assert addr_obj['txrefs'][0]['tx_output_n'] == 0
            elif address == '1FvzCLoTPGANNjWoUo6jUGuAG3wg1w4YjR':
                assert len(addresses_details[1]['txrefs']) == 1
                assert addr_obj['txrefs'][0]['tx_hash'] == '999e1c837c76a1b7fbb7e57baf87b309960f5ffefbf2a9b95dd890602272f644'
                assert addr_obj['txrefs'][0]['block_height'] == 3
                assert addr_obj['txrefs'][0]['confirmed'] is not None
                assert addr_obj['txrefs'][0]['tx_input_n'] == -1
                assert addr_obj['txrefs'][0]['tx_output_n'] == 0
            else:
                assert False, 'Invalid address: %s' % address
Beispiel #2
0
    def test_get_addresses_details(self):
        addresses_details = get_addresses_details(
            address_list=[
                # 2 of the first used BTC addresses
                '1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1',
                '1FvzCLoTPGANNjWoUo6jUGuAG3wg1w4YjR',
            ],
            coin_symbol='btc',
            txn_limit=None,
            api_key=BC_API_KEY,
            # This way the test result never changes:
            before_bh=4,
            include_script=True,
        )

        assert len(addresses_details) == 2

        for addr_obj in addresses_details:
            address = addr_obj.get('address')
            if address == '1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1':
                assert len(addr_obj['txrefs']) == 1
                assert addr_obj['txrefs'][0][
                    'tx_hash'] == '9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5'
                assert addr_obj['txrefs'][0]['block_height'] == 2
                assert addr_obj['txrefs'][0]['confirmed'] is not None
                assert addr_obj['txrefs'][0]['tx_input_n'] == -1
                assert addr_obj['txrefs'][0]['tx_output_n'] == 0
            elif address == '1FvzCLoTPGANNjWoUo6jUGuAG3wg1w4YjR':
                assert len(addresses_details[1]['txrefs']) == 1
                assert addr_obj['txrefs'][0][
                    'tx_hash'] == '999e1c837c76a1b7fbb7e57baf87b309960f5ffefbf2a9b95dd890602272f644'
                assert addr_obj['txrefs'][0]['block_height'] == 3
                assert addr_obj['txrefs'][0]['confirmed'] is not None
                assert addr_obj['txrefs'][0]['tx_input_n'] == -1
                assert addr_obj['txrefs'][0]['tx_output_n'] == 0
            else:
                assert False, 'Invalid address: %s' % address
            for txref in addr_obj['txrefs']:
                assert 'script' in txref, txref