TestBitcoinEmulator

class tests.test_bitcoin.TestBitcoinEmulator(methodName='runTest')[source]
EXTERNAL_ADDRESS = '13J8HRihYqEDYHAxLciryQYTjpxXcjYMmR'

A Bitcoin address considered ‘foreign’ for testing that sending reduces balance

LOCAL_ADDRESS = '1PNgW6AgPZMys844kFS2dK4tt7F36MzLC8'

A Bitcoin address considered to be in the wallet

emulator = None

Stores the Process returned from bitcoin.j_server()

classmethod setUpClass() → None[source]

Launch the Bitcoin RPC emulator in the background on default port 8332

classmethod tearDownClass() → None[source]

Shutdown the Bitcoin RPC emulator process

test_get_transaction()[source]

Test gettransaction returns the correct transaction

test_getblockchaininfo()[source]

Test that the getblockchaininfo JsonRPC call returns data as expected

test_getnetworkinfo()[source]

Test that the getnetworkinfo JsonRPC call returns data as expected

test_getnewaddress()[source]

Get a new address from the emulator and confirm it seems like a BTC address

test_send_valid()[source]

Test sending coins to external address creates a TX in listtransactions, and reduces the balance

test_validate_address()[source]

Test validateaddress with a valid and invalid address

Methods

Methods

setUpClass()

Launch the Bitcoin RPC emulator in the background on default port 8332

tearDownClass()

Shutdown the Bitcoin RPC emulator process

test_getblockchaininfo()

Test that the getblockchaininfo JsonRPC call returns data as expected

test_getnetworkinfo()

Test that the getnetworkinfo JsonRPC call returns data as expected

test_getnewaddress()

Get a new address from the emulator and confirm it seems like a BTC address

test_send_valid()

Test sending coins to external address creates a TX in listtransactions, and reduces the balance

Attributes

Attributes

EXTERNAL_ADDRESS

A Bitcoin address considered ‘foreign’ for testing that sending reduces balance

LOCAL_ADDRESS

A Bitcoin address considered to be in the wallet

rpc

Wrapper class for JsonRPC, with default host 127.0.0.1 and port 8332 Contains pre-defined methods with pydoc for interacting with bitcoind compatible JsonRPC services including most coin daemons forked from Bitcoin, e.g.