test suite: clean up swap_server_stop()
This commit is contained in:
parent
800b3cef36
commit
a93173f43c
3 changed files with 21 additions and 19 deletions
|
|
@ -29,7 +29,6 @@ from .regtest import CmdTestRegtest
|
|||
from .swap import CmdTestSwapMethods
|
||||
from .ethswap import CmdTestEthSwapMethods
|
||||
|
||||
swap_server = ThornodeSwapServer()
|
||||
burn_addr = 'beefcafe22' * 4
|
||||
method_template = """
|
||||
def {name}(self):
|
||||
|
|
@ -139,6 +138,7 @@ class CmdTestEthBump(CmdTestEthBumpMethods, CmdTestEthSwapMethods, CmdTestSwapMe
|
|||
# ('subgroup.token_feebump_swap', ['token_init_swap']), # TBD
|
||||
('subgroup.token_new_outputs_swap', ['token_init_swap']),
|
||||
('ltc_stop', ''),
|
||||
('swap_server_stop', 'stopping the Thornode server'),
|
||||
('stop', 'stopping daemon'),
|
||||
)
|
||||
cmd_subgroups = {
|
||||
|
|
@ -292,7 +292,8 @@ class CmdTestEthBump(CmdTestEthBumpMethods, CmdTestEthSwapMethods, CmdTestSwapMe
|
|||
ethbump_ltc = CmdTestRunner(cfg, t.repo_root, t.data_dir, t.trash_dir, t.trash_dir2)
|
||||
ethbump_ltc.init_group('ethbump_ltc')
|
||||
|
||||
swap_server.start()
|
||||
self.swap_server = ThornodeSwapServer()
|
||||
self.swap_server.start()
|
||||
|
||||
def txcreate1(self):
|
||||
return self._txcreate(args=[f'{burn_addr},987'], acct='1')
|
||||
|
|
@ -441,6 +442,9 @@ class CmdTestEthBump(CmdTestEthBumpMethods, CmdTestEthSwapMethods, CmdTestSwapMe
|
|||
token_swaptxbump1sign = token_swaptxbump2sign = swaptxbump1sign = swaptxbump2sign = token_txbump2sign
|
||||
token_swaptxbump1send = token_swaptxbump2send = swaptxbump1send = swaptxbump2send = token_txbump2send
|
||||
|
||||
def swap_server_stop(self):
|
||||
return self._thornode_server_stop()
|
||||
|
||||
class CmdTestEthBumpLTC(CmdTestSwapMethods, CmdTestRegtest):
|
||||
network = ('ltc',)
|
||||
tmpdir_nums = [43]
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@ from .regtest import CmdTestRegtest
|
|||
from .swap import CmdTestSwapMethods
|
||||
from .ethdev import CmdTestEthdev
|
||||
|
||||
swap_server = ThornodeSwapServer()
|
||||
|
||||
method_template = """
|
||||
def {name}(self):
|
||||
self.spawn(log_only=True)
|
||||
|
|
@ -281,7 +279,8 @@ class CmdTestEthSwap(CmdTestSwapMethods, CmdTestRegtest):
|
|||
ethswap_eth = CmdTestRunner(cfg, t.repo_root, t.data_dir, t.trash_dir, t.trash_dir2)
|
||||
ethswap_eth.init_group(self.eth_group)
|
||||
|
||||
swap_server.start()
|
||||
self.swap_server = ThornodeSwapServer()
|
||||
self.swap_server.start()
|
||||
|
||||
def swaptxcreate1(self):
|
||||
t = self._swaptxcreate(['BTC', '8.765', 'ETH'])
|
||||
|
|
@ -327,13 +326,7 @@ class CmdTestEthSwap(CmdTestSwapMethods, CmdTestRegtest):
|
|||
return self._swaptxcreate_ui_common(t)
|
||||
|
||||
def swap_server_stop(self):
|
||||
self.spawn(msg_only=True)
|
||||
if self.cfg.no_daemon_stop:
|
||||
msg_r('(leaving thornode server running by user request)')
|
||||
imsg('')
|
||||
else:
|
||||
swap_server.stop()
|
||||
return 'ok'
|
||||
return self._thornode_server_stop()
|
||||
|
||||
class CmdTestEthSwapEth(CmdTestEthSwapMethods, CmdTestSwapMethods, CmdTestEthdev):
|
||||
'Ethereum swap operations - Ethereum wallet'
|
||||
|
|
|
|||
|
|
@ -17,15 +17,13 @@ from pathlib import Path
|
|||
from mmgen.protocol import init_proto
|
||||
from mmgen.wallet.mmgen import wallet as MMGenWallet
|
||||
|
||||
from ..include.common import make_burn_addr, gr_uc
|
||||
from ..include.common import imsg, make_burn_addr, gr_uc
|
||||
from .include.common import dfl_bip39_file, dfl_words_file
|
||||
from .httpd.thornode_swap import ThornodeSwapServer
|
||||
|
||||
from .autosign import CmdTestAutosign, CmdTestAutosignThreaded
|
||||
from .regtest import CmdTestRegtest, rt_data, dfl_wcls, rt_pw, strip_ansi_escapes
|
||||
|
||||
swap_server = ThornodeSwapServer()
|
||||
|
||||
sample1 = gr_uc[:24]
|
||||
sample2 = '00010203040506'
|
||||
|
||||
|
|
@ -262,6 +260,14 @@ class CmdTestSwapMethods:
|
|||
assert data
|
||||
return 'ok'
|
||||
|
||||
def _thornode_server_stop(self, attrname='swap_server', name='thornode swap server'):
|
||||
self.spawn(msg_only=True)
|
||||
if self.cfg.no_daemon_stop:
|
||||
imsg(f'(leaving {name} running by user request)')
|
||||
else:
|
||||
getattr(self, attrname).stop()
|
||||
return 'ok'
|
||||
|
||||
class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
||||
bdb_wallet = True
|
||||
networks = ('btc',)
|
||||
|
|
@ -408,7 +414,8 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
|||
|
||||
self.protos = [init_proto(cfg, k, network='regtest', need_amt=True) for k in ('btc', 'ltc', 'bch')]
|
||||
|
||||
swap_server.start()
|
||||
self.swap_server = ThornodeSwapServer()
|
||||
self.swap_server.start()
|
||||
|
||||
self.opts.append('--bob')
|
||||
|
||||
|
|
@ -777,6 +784,4 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
|||
return self._mempool(2)
|
||||
|
||||
def swap_server_stop(self):
|
||||
self.spawn(msg_only=True)
|
||||
swap_server.stop()
|
||||
return 'ok'
|
||||
return self._thornode_server_stop()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue