mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-06 10:49:27 +00:00
Test random amounts.
This commit is contained in:
parent
05c9d9c66d
commit
b36b6fb306
1 changed files with 12 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
import signal
|
import signal
|
||||||
import logging
|
import logging
|
||||||
|
@ -261,6 +262,8 @@ class Test(unittest.TestCase):
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(Test, cls).setUpClass()
|
super(Test, cls).setUpClass()
|
||||||
|
|
||||||
|
random.seed(time.time())
|
||||||
|
|
||||||
cls.update_thread = None
|
cls.update_thread = None
|
||||||
cls.coins_update_thread = None
|
cls.coins_update_thread = None
|
||||||
cls.http_threads = []
|
cls.http_threads = []
|
||||||
|
@ -567,8 +570,15 @@ class Test(unittest.TestCase):
|
||||||
def test_06_multiple_swaps(self):
|
def test_06_multiple_swaps(self):
|
||||||
logging.info('---------- Test Multiple concurrent swaps')
|
logging.info('---------- Test Multiple concurrent swaps')
|
||||||
swap_clients = self.swap_clients
|
swap_clients = self.swap_clients
|
||||||
offer1_id = swap_clients[0].postOffer(Coins.BTC, Coins.XMR, 10 * COIN, 100 * XMR_COIN, 10 * COIN, SwapTypes.XMR_SWAP)
|
|
||||||
offer2_id = swap_clients[0].postOffer(Coins.PART, Coins.XMR, 10 * COIN, 0.14 * XMR_COIN, 10 * COIN, SwapTypes.XMR_SWAP)
|
amt_1 = make_int(random.uniform(0.001, 100.0), scale=8, r=1)
|
||||||
|
amt_2 = make_int(random.uniform(0.001, 100.0), scale=8, r=1)
|
||||||
|
|
||||||
|
rate_1 = make_int(random.uniform(80.0, 110.0), scale=12, r=1)
|
||||||
|
rate_2 = make_int(random.uniform(0.01, 0.5), scale=12, r=1)
|
||||||
|
|
||||||
|
offer1_id = swap_clients[0].postOffer(Coins.BTC, Coins.XMR, amt_1, rate_1, amt_1, SwapTypes.XMR_SWAP)
|
||||||
|
offer2_id = swap_clients[0].postOffer(Coins.PART, Coins.XMR, amt_2, rate_2, amt_2, SwapTypes.XMR_SWAP)
|
||||||
|
|
||||||
wait_for_offer(delay_event, swap_clients[1], offer1_id)
|
wait_for_offer(delay_event, swap_clients[1], offer1_id)
|
||||||
offer1 = swap_clients[1].getOffer(offer1_id)
|
offer1 = swap_clients[1].getOffer(offer1_id)
|
||||||
|
|
Loading…
Reference in a new issue