Browse Source

test_walletutils.py: enhance tests coverage

add-joinmarket
zebra-lucky 1 year ago
parent
commit
67640b351f
  1. 3
      electrum/plugins/joinmarket/jmclient/wallet_utils.py
  2. 1
      electrum/plugins/joinmarket/notes.txt
  3. 21
      electrum/plugins/joinmarket/tests/jmclient/test_walletutils.py

3
electrum/plugins/joinmarket/jmclient/wallet_utils.py

@ -415,7 +415,8 @@ def wallet_display(jmman, showprivkey, displayall=False,
balance, status = get_addr_status(
path, utxos[m], utxos_enabled[m], is_new, address_type)
if showprivkey:
privkey = jmman.get_wif_path(path)
# privkey = jmman.get_wif_path(path) FIXME no get_wif_path
privkey = '' # FIXME
else:
privkey = ''
if (displayall or balance > 0 or

1
electrum/plugins/joinmarket/notes.txt

@ -1,6 +1,7 @@
-------------------------------------------------------------------------------
plugin:
- покращення покриття тестами
- jm_base_code.py: add get_wif_path (need password if wallet/ks encrypted)
- потрібно якось документувати
- qml gui
- jm_qt_obwatch: advanced sorting by columns, filter by text

21
electrum/plugins/joinmarket/tests/jmclient/test_walletutils.py

@ -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)

Loading…
Cancel
Save