mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
tests: Run more tests in ci.
This commit is contained in:
@@ -230,6 +230,14 @@ def wait_for_none_active(delay_event, port, wait_for=30):
|
||||
raise ValueError('wait_for_none_active timed out.')
|
||||
|
||||
|
||||
def abandon_all_swaps(delay_event, swap_client) -> None:
|
||||
logging.info('abandon_all_swaps')
|
||||
for bid in swap_client.listBids(sent=True):
|
||||
swap_client.abandonBid(bid[2])
|
||||
for bid in swap_client.listBids(sent=False):
|
||||
swap_client.abandonBid(bid[2])
|
||||
|
||||
|
||||
def waitForNumOffers(delay_event, port, offers, wait_for=20):
|
||||
for i in range(wait_for):
|
||||
if delay_event.is_set():
|
||||
|
||||
@@ -31,6 +31,7 @@ from tests.basicswap.util import (
|
||||
read_json_api,
|
||||
)
|
||||
from tests.basicswap.common import (
|
||||
abandon_all_swaps,
|
||||
wait_for_bid,
|
||||
wait_for_event,
|
||||
wait_for_offer,
|
||||
@@ -1198,6 +1199,8 @@ class TestBTC(BasicSwapTest):
|
||||
assert (jsw['locked'] is False)
|
||||
|
||||
def test_01_full_swap(self):
|
||||
abandon_all_swaps(test_delay_event, self.swap_clients[0])
|
||||
wait_for_none_active(test_delay_event, 1800)
|
||||
js_0 = read_json_api(1800, 'wallets')
|
||||
if not js_0['PART']['encrypted']:
|
||||
read_json_api(1800, 'setpassword', {'oldpassword': '', 'newpassword': 'notapassword123'})
|
||||
|
||||
@@ -660,7 +660,7 @@ class Test(BaseTest):
|
||||
js_w2 = read_json_api(1802, 'wallets')
|
||||
if float(js_w2['PART']['balance']) < 100.0:
|
||||
post_json = {
|
||||
'value': 100,
|
||||
'value': 100.0,
|
||||
'address': js_w2['PART']['deposit_address'],
|
||||
'subfee': False,
|
||||
}
|
||||
@@ -678,8 +678,8 @@ class Test(BaseTest):
|
||||
'subfee': True,
|
||||
}
|
||||
json_rv = read_json_api(TEST_HTTP_PORT + 2, 'wallets/part/withdraw', post_json)
|
||||
wait_for_balance(test_delay_event, 'http://127.0.0.1:1802/json/wallets/part', 'balance', 10.0)
|
||||
assert (len(json_rv['txid']) == 64)
|
||||
wait_for_balance(test_delay_event, 'http://127.0.0.1:1802/json/wallets/part', 'balance', 10.0)
|
||||
|
||||
# Create prefunded ITX
|
||||
ci = swap_clients[2].ci(Coins.PART)
|
||||
|
||||
@@ -336,6 +336,7 @@ class BaseTest(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
test_delay_event.clear()
|
||||
random.seed(time.time())
|
||||
|
||||
logger.propagate = False
|
||||
@@ -618,6 +619,13 @@ class BaseTest(unittest.TestCase):
|
||||
stopDaemons(cls.btc_daemons)
|
||||
stopDaemons(cls.ltc_daemons)
|
||||
|
||||
cls.http_threads.clear()
|
||||
cls.swap_clients.clear()
|
||||
cls.part_daemons.clear()
|
||||
cls.btc_daemons.clear()
|
||||
cls.ltc_daemons.clear()
|
||||
cls.xmr_daemons.clear()
|
||||
|
||||
super(BaseTest, cls).tearDownClass()
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user