mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
Increase version, add test for bids sent while recipient is offline.
This commit is contained in:
@@ -152,7 +152,7 @@ def prepareDir(datadir, nodeId, network_key, network_pubkey):
|
||||
'debug': True,
|
||||
'zmqhost': 'tcp://127.0.0.1',
|
||||
'zmqport': BASE_ZMQ_PORT + nodeId,
|
||||
'htmlhost': 'localhost',
|
||||
'htmlhost': '127.0.0.1',
|
||||
'htmlport': 12700 + nodeId,
|
||||
'network_key': network_key,
|
||||
'network_pubkey': network_pubkey,
|
||||
@@ -423,8 +423,8 @@ class Test(unittest.TestCase):
|
||||
wait_for_bid(delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, wait_for=60)
|
||||
wait_for_bid(delay_event, swap_clients[1], bid_id, BidStates.SWAP_COMPLETED, sent=True, wait_for=60)
|
||||
|
||||
js_0 = json.loads(urlopen('http://localhost:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://localhost:1801/json').read())
|
||||
js_0 = json.loads(urlopen('http://127.0.0.1:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://127.0.0.1:1801/json').read())
|
||||
assert(js_0['num_swapping'] == 0 and js_0['num_watched_outputs'] == 0)
|
||||
assert(js_1['num_swapping'] == 0 and js_1['num_watched_outputs'] == 0)
|
||||
|
||||
@@ -448,8 +448,8 @@ class Test(unittest.TestCase):
|
||||
wait_for_bid(delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, sent=True, wait_for=60)
|
||||
wait_for_bid(delay_event, swap_clients[1], bid_id, BidStates.SWAP_COMPLETED, wait_for=60)
|
||||
|
||||
js_0 = json.loads(urlopen('http://localhost:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://localhost:1801/json').read())
|
||||
js_0 = json.loads(urlopen('http://127.0.0.1:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://127.0.0.1:1801/json').read())
|
||||
assert(js_0['num_swapping'] == 0 and js_0['num_watched_outputs'] == 0)
|
||||
assert(js_1['num_swapping'] == 0 and js_1['num_watched_outputs'] == 0)
|
||||
|
||||
@@ -473,10 +473,10 @@ class Test(unittest.TestCase):
|
||||
wait_for_bid(delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, wait_for=60)
|
||||
wait_for_bid(delay_event, swap_clients[1], bid_id, BidStates.SWAP_COMPLETED, sent=True, wait_for=60)
|
||||
|
||||
js_0bid = json.loads(urlopen('http://localhost:1800/json/bids/{}'.format(bid_id.hex())).read())
|
||||
js_0bid = json.loads(urlopen('http://127.0.0.1:1800/json/bids/{}'.format(bid_id.hex())).read())
|
||||
|
||||
js_0 = json.loads(urlopen('http://localhost:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://localhost:1801/json').read())
|
||||
js_0 = json.loads(urlopen('http://127.0.0.1:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://127.0.0.1:1801/json').read())
|
||||
|
||||
assert(js_0['num_swapping'] == 0 and js_0['num_watched_outputs'] == 0)
|
||||
assert(js_1['num_swapping'] == 0 and js_1['num_watched_outputs'] == 0)
|
||||
@@ -502,8 +502,8 @@ class Test(unittest.TestCase):
|
||||
wait_for_bid(delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, wait_for=60)
|
||||
wait_for_bid(delay_event, swap_clients[1], bid_id, BidStates.BID_ABANDONED, sent=True, wait_for=60)
|
||||
|
||||
js_0 = json.loads(urlopen('http://localhost:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://localhost:1801/json').read())
|
||||
js_0 = json.loads(urlopen('http://127.0.0.1:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://127.0.0.1:1801/json').read())
|
||||
assert(js_0['num_swapping'] == 0 and js_0['num_watched_outputs'] == 0)
|
||||
assert(js_1['num_swapping'] == 0 and js_1['num_watched_outputs'] == 0)
|
||||
|
||||
@@ -511,7 +511,7 @@ class Test(unittest.TestCase):
|
||||
logging.info('---------- Test same client, BTC to LTC')
|
||||
swap_clients = self.swap_clients
|
||||
|
||||
js_0_before = json.loads(urlopen('http://localhost:1800/json').read())
|
||||
js_0_before = json.loads(urlopen('http://127.0.0.1:1800/json').read())
|
||||
|
||||
offer_id = swap_clients[0].postOffer(Coins.BTC, Coins.LTC, 10 * COIN, 10 * COIN, 10 * COIN, SwapTypes.SELLER_FIRST)
|
||||
|
||||
@@ -527,7 +527,7 @@ class Test(unittest.TestCase):
|
||||
wait_for_bid_tx_state(delay_event, swap_clients[0], bid_id, TxStates.TX_REDEEMED, TxStates.TX_REDEEMED, wait_for=60)
|
||||
wait_for_bid(delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, wait_for=60)
|
||||
|
||||
js_0 = json.loads(urlopen('http://localhost:1800/json').read())
|
||||
js_0 = json.loads(urlopen('http://127.0.0.1:1800/json').read())
|
||||
assert(js_0['num_swapping'] == 0 and js_0['num_watched_outputs'] == 0)
|
||||
assert(js_0['num_recv_bids'] == js_0_before['num_recv_bids'] + 1 and js_0['num_sent_bids'] == js_0_before['num_sent_bids'] + 1)
|
||||
|
||||
@@ -535,7 +535,7 @@ class Test(unittest.TestCase):
|
||||
logging.info('---------- Test error, BTC to LTC, set fee above bid value')
|
||||
swap_clients = self.swap_clients
|
||||
|
||||
js_0_before = json.loads(urlopen('http://localhost:1800/json').read())
|
||||
js_0_before = json.loads(urlopen('http://127.0.0.1:1800/json').read())
|
||||
|
||||
offer_id = swap_clients[0].postOffer(Coins.BTC, Coins.LTC, 0.001 * COIN, 1.0 * COIN, 0.001 * COIN, SwapTypes.SELLER_FIRST)
|
||||
|
||||
@@ -580,8 +580,8 @@ class Test(unittest.TestCase):
|
||||
wait_for_bid(delay_event, swap_clients[0], bid_id, BidStates.SWAP_COMPLETED, wait_for=60)
|
||||
wait_for_bid(delay_event, swap_clients[1], bid_id, BidStates.SWAP_COMPLETED, sent=True, wait_for=60)
|
||||
|
||||
js_0 = json.loads(urlopen('http://localhost:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://localhost:1801/json').read())
|
||||
js_0 = json.loads(urlopen('http://127.0.0.1:1800/json').read())
|
||||
js_1 = json.loads(urlopen('http://127.0.0.1:1801/json').read())
|
||||
assert(js_0['num_swapping'] == 0 and js_0['num_watched_outputs'] == 0)
|
||||
assert(js_1['num_swapping'] == 0 and js_1['num_watched_outputs'] == 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user