def test_btc_wallet_transfer_no_funds(self):
        """
        Test that the transfer method of a BTC wallet raises an error when we don't have enough funds
        """
        test_deferred = Deferred()

        wallet = BitcoinWallet(self.session_base_dir)
        mock_daemon = MockObject()
        wallet.get_daemon = lambda: mock_daemon

        wallet.transfer(
            3, 'abacd').addErrback(lambda _: test_deferred.callback(None))
        return test_deferred
    def test_btc_wallet_transfer(self):
        """
        Test that the transfer method of a BTC wallet
        """
        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')