|
|
|
|
@ -1,10 +1,15 @@
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
|
|
|
from electrum.plugins.joinmarket.jmclient.wallet_utils import ( |
|
|
|
|
WalletView, WalletViewAccount, WalletViewBranch, WalletViewEntry) |
|
|
|
|
WalletView, WalletViewAccount, WalletViewBranch, WalletViewEntry, |
|
|
|
|
wallet_display) |
|
|
|
|
|
|
|
|
|
from electrum.plugins.joinmarket.tests import JMTestCase |
|
|
|
|
|
|
|
|
|
def test_walletview(): |
|
|
|
|
|
|
|
|
|
class WalletUtilsTestCase(JMTestCase): |
|
|
|
|
|
|
|
|
|
async def test_walletview(self): |
|
|
|
|
rootpath = "m/0" |
|
|
|
|
walletbranch = 0 |
|
|
|
|
accounts = range(3) |
|
|
|
|
@ -17,13 +22,15 @@ def test_walletview():
|
|
|
|
|
entries.append( |
|
|
|
|
WalletViewEntry( |
|
|
|
|
rootpath, a, address_type, i, |
|
|
|
|
"DUMMYADDRESS" + str(i+a), [i*10000000, i*10000000])) |
|
|
|
|
"DUMMYADDRESS" + str(i+a), |
|
|
|
|
[i*10000000, i*10000000])) |
|
|
|
|
branches.append( |
|
|
|
|
WalletViewBranch( |
|
|
|
|
rootpath, a, address_type, branchentries=entries, |
|
|
|
|
xpub="xpubDUMMYXPUB" + str(a + address_type))) |
|
|
|
|
acctlist.append(WalletViewAccount(rootpath, a, branches=branches)) |
|
|
|
|
wallet = WalletView(rootpath + "/" + str(walletbranch), accounts=acctlist) |
|
|
|
|
wallet = WalletView(rootpath + "/" + str(walletbranch), |
|
|
|
|
accounts=acctlist) |
|
|
|
|
assert wallet.serialize() == ( |
|
|
|
|
'JM wallet\n' |
|
|
|
|
'mixdepth\t0\n' |
|
|
|
|
@ -69,3 +76,9 @@ def test_walletview():
|
|
|
|
|
'Balance:\t0.60000000\n' |
|
|
|
|
'Balance for mixdepth 2:\t1.20000000\n' |
|
|
|
|
'Total balance:\t3.60000000') |
|
|
|
|
|
|
|
|
|
async def test_wallet_display(self): |
|
|
|
|
jmman = self.jmman |
|
|
|
|
wallet_display( |
|
|
|
|
jmman, showprivkey=True, displayall=True, serialized=True, |
|
|
|
|
summarized=True, mixdepth=None, jsonified=False) |
|
|
|
|
|