mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
wownero: Add test.
This commit is contained in:
@@ -96,43 +96,6 @@ class TestFunctions(BaseTest):
|
||||
|
||||
return float(js_wallets[coin_ticker][balance_type]) + float(js_wallets[coin_ticker][unconfirmed_name])
|
||||
|
||||
def prepare_balance(self, coin, amount: float, port_target_node: int, port_take_from_node: int, test_balance: bool = True) -> None:
|
||||
delay_iterations = 100 if coin == Coins.NAV else 20
|
||||
delay_time = 5 if coin == Coins.NAV else 3
|
||||
if coin == Coins.PART_BLIND:
|
||||
coin_ticker: str = 'PART'
|
||||
balance_type: str = 'blind_balance'
|
||||
address_type: str = 'stealth_address'
|
||||
type_to: str = 'blind'
|
||||
elif coin == Coins.PART_ANON:
|
||||
coin_ticker: str = 'PART'
|
||||
balance_type: str = 'anon_balance'
|
||||
address_type: str = 'stealth_address'
|
||||
type_to: str = 'anon'
|
||||
else:
|
||||
coin_ticker: str = coin.name
|
||||
balance_type: str = 'balance'
|
||||
address_type: str = 'deposit_address'
|
||||
js_w = read_json_api(port_target_node, 'wallets')
|
||||
current_balance: float = float(js_w[coin_ticker][balance_type])
|
||||
if test_balance and current_balance >= amount:
|
||||
return
|
||||
post_json = {
|
||||
'value': amount,
|
||||
'address': js_w[coin_ticker][address_type],
|
||||
'subfee': False,
|
||||
}
|
||||
if coin in (Coins.XMR, ):
|
||||
post_json['sweepall'] = False
|
||||
if coin in (Coins.PART_BLIND, Coins.PART_ANON):
|
||||
post_json['type_to'] = type_to
|
||||
json_rv = read_json_api(port_take_from_node, 'wallets/{}/withdraw'.format(coin_ticker.lower()), post_json)
|
||||
assert (len(json_rv['txid']) == 64)
|
||||
wait_for_amount: float = amount
|
||||
if not test_balance:
|
||||
wait_for_amount += current_balance
|
||||
wait_for_balance(test_delay_event, 'http://127.0.0.1:{}/json/wallets/{}'.format(port_target_node, coin_ticker.lower()), balance_type, wait_for_amount, iterations=delay_iterations, delay_time=delay_time)
|
||||
|
||||
def do_test_01_full_swap(self, coin_from: Coins, coin_to: Coins) -> None:
|
||||
logging.info('---------- Test {} to {}'.format(coin_from.name, coin_to.name))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user