'Test that the transfer method of a BTC wallet'

@deferred(timeout=10)
def test_btc_wallet_transfer(self):

    def mocked_run_cmdline(request):
        if (request['cmd'] == 'payto'):
            return {'hex': 'abcd'}
        elif (request['cmd'] == 'broadcast'):
            return (True, 'abcd')
    wallet = BitcoinWallet(self.session_base_dir)
    mock_daemon = MockObject()
    mock_server = MockObject()
    mock_server.run_cmdline = mocked_run_cmdline
    mock_daemon.get_server = (lambda _: mock_server)
    wallet.get_daemon = (lambda : mock_daemon)
    wallet.get_balance = (lambda : succeed({'available': 5}))
    return wallet.transfer(3, 'abacd')
