Ensure remote_daemon_urls appears in settings if automatically_select_daemon is present.
This commit is contained in:
parent
b0d169421f
commit
a78880bc98
@ -6401,13 +6401,15 @@ class BasicSwap(BaseApp):
|
|||||||
remotedaemonurls.add(url.strip())
|
remotedaemonurls.add(url.strip())
|
||||||
|
|
||||||
if set(settings_cc.get('remote_daemon_urls', [])) != remotedaemonurls:
|
if set(settings_cc.get('remote_daemon_urls', [])) != remotedaemonurls:
|
||||||
if len(remotedaemonurls) == 0 and 'remote_daemon_urls' in settings_cc:
|
settings_cc['remote_daemon_urls'] = list(remotedaemonurls)
|
||||||
del settings_cc['remote_daemon_urls']
|
|
||||||
else:
|
|
||||||
settings_cc['remote_daemon_urls'] = list(remotedaemonurls)
|
|
||||||
settings_changed = True
|
settings_changed = True
|
||||||
suggest_reboot = True
|
suggest_reboot = True
|
||||||
|
|
||||||
|
# Ensure remote_daemon_urls appears in settings if automatically_select_daemon is present
|
||||||
|
if 'automatically_select_daemon' in settings_cc and 'remote_daemon_urls' not in settings_cc:
|
||||||
|
settings_cc['remote_daemon_urls'] = []
|
||||||
|
settings_changed = True
|
||||||
|
|
||||||
if 'fee_priority' in data:
|
if 'fee_priority' in data:
|
||||||
new_fee_priority = data['fee_priority']
|
new_fee_priority = data['fee_priority']
|
||||||
ensure(new_fee_priority >= 0 and new_fee_priority < 4, 'Invalid priority')
|
ensure(new_fee_priority >= 0 and new_fee_priority < 4, 'Invalid priority')
|
||||||
|
@ -149,6 +149,8 @@ def runClient(fp, data_dir, chain, start_only_coins):
|
|||||||
# Ensure daemons are stopped
|
# Ensure daemons are stopped
|
||||||
swap_client.stopDaemons()
|
swap_client.stopDaemons()
|
||||||
|
|
||||||
|
# Settings may have been modified
|
||||||
|
settings = swap_client.settings
|
||||||
try:
|
try:
|
||||||
# Try start daemons
|
# Try start daemons
|
||||||
for c, v in settings['chainclients'].items():
|
for c, v in settings['chainclients'].items():
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (c) 2022-2023 tecnovert
|
# Copyright (c) 2022-2024 tecnovert
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@ -17,6 +17,13 @@ from util import get_driver
|
|||||||
from basicswap.ui.page_offers import default_chart_api_key
|
from basicswap.ui.page_offers import default_chart_api_key
|
||||||
|
|
||||||
|
|
||||||
|
def click_option(el, option_text):
|
||||||
|
for option in el.find_elements(By.TAG_NAME, 'option'):
|
||||||
|
if option.text == option_text:
|
||||||
|
option.click()
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
def test_settings(driver):
|
def test_settings(driver):
|
||||||
base_url = 'http://localhost:12701'
|
base_url = 'http://localhost:12701'
|
||||||
node2_url = 'http://localhost:12702'
|
node2_url = 'http://localhost:12702'
|
||||||
@ -31,18 +38,12 @@ def test_settings(driver):
|
|||||||
el = driver.find_element(By.NAME, 'debugmode')
|
el = driver.find_element(By.NAME, 'debugmode')
|
||||||
selected_option = Select(el).first_selected_option
|
selected_option = Select(el).first_selected_option
|
||||||
assert (selected_option.text == 'True')
|
assert (selected_option.text == 'True')
|
||||||
for option in el.find_elements(By.TAG_NAME, 'option'):
|
click_option(el, 'False')
|
||||||
if option.text == 'False':
|
|
||||||
option.click()
|
|
||||||
break
|
|
||||||
|
|
||||||
el = driver.find_element(By.NAME, 'debugui')
|
el = driver.find_element(By.NAME, 'debugui')
|
||||||
selected_option = Select(el).first_selected_option
|
selected_option = Select(el).first_selected_option
|
||||||
assert (selected_option.text == 'False')
|
assert (selected_option.text == 'False')
|
||||||
for option in el.find_elements(By.TAG_NAME, 'option'):
|
click_option(el, 'True')
|
||||||
if option.text == 'True':
|
|
||||||
option.click()
|
|
||||||
break
|
|
||||||
|
|
||||||
btn_apply_general.click()
|
btn_apply_general.click()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@ -57,10 +58,7 @@ def test_settings(driver):
|
|||||||
el = driver.find_element(By.NAME, 'showchart')
|
el = driver.find_element(By.NAME, 'showchart')
|
||||||
selected_option = Select(el).first_selected_option
|
selected_option = Select(el).first_selected_option
|
||||||
assert (selected_option.text == 'True')
|
assert (selected_option.text == 'True')
|
||||||
for option in el.find_elements(By.TAG_NAME, 'option'):
|
click_option(el, 'False')
|
||||||
if option.text == 'False':
|
|
||||||
option.click()
|
|
||||||
break
|
|
||||||
|
|
||||||
difficult_text = '`~!@#$%^&*()-_=+[{}]\\|;:\'",<>./? '
|
difficult_text = '`~!@#$%^&*()-_=+[{}]\\|;:\'",<>./? '
|
||||||
el = driver.find_element(By.NAME, 'chartapikey')
|
el = driver.find_element(By.NAME, 'chartapikey')
|
||||||
@ -94,6 +92,16 @@ def test_settings(driver):
|
|||||||
|
|
||||||
assert (settings.get('chart_api_key') == hex_text)
|
assert (settings.get('chart_api_key') == hex_text)
|
||||||
|
|
||||||
|
# Reset
|
||||||
|
btn_apply_general = wait.until(EC.element_to_be_clickable((By.NAME, 'apply_general')))
|
||||||
|
click_option(driver.find_element(By.NAME, 'debugmode'), 'True')
|
||||||
|
click_option(driver.find_element(By.NAME, 'debugui'), 'False')
|
||||||
|
btn_apply_general.click()
|
||||||
|
btn_apply_chart = wait.until(EC.element_to_be_clickable((By.NAME, 'apply_chart')))
|
||||||
|
click_option(driver.find_element(By.NAME, 'showchart'), 'True')
|
||||||
|
btn_apply_chart.click()
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
# Apply XMR settings with blank nodes list
|
# Apply XMR settings with blank nodes list
|
||||||
driver.find_element(By.ID, 'coins-tab').click()
|
driver.find_element(By.ID, 'coins-tab').click()
|
||||||
btn_apply_monero = wait.until(EC.element_to_be_clickable((By.NAME, 'apply_monero')))
|
btn_apply_monero = wait.until(EC.element_to_be_clickable((By.NAME, 'apply_monero')))
|
||||||
@ -104,7 +112,7 @@ def test_settings(driver):
|
|||||||
|
|
||||||
with open(settings_path_0) as fs:
|
with open(settings_path_0) as fs:
|
||||||
settings = json.load(fs)
|
settings = json.load(fs)
|
||||||
assert ('remote_daemon_urls' not in settings['chainclients']['monero'])
|
assert (len(settings['chainclients']['monero']['remote_daemon_urls']) == 0)
|
||||||
|
|
||||||
btn_apply_monero = wait.until(EC.element_to_be_clickable((By.NAME, 'apply_monero')))
|
btn_apply_monero = wait.until(EC.element_to_be_clickable((By.NAME, 'apply_monero')))
|
||||||
el = driver.find_element(By.NAME, 'remotedaemonurls_monero')
|
el = driver.find_element(By.NAME, 'remotedaemonurls_monero')
|
||||||
@ -126,7 +134,7 @@ def test_settings(driver):
|
|||||||
|
|
||||||
with open(settings_path_0) as fs:
|
with open(settings_path_0) as fs:
|
||||||
settings = json.load(fs)
|
settings = json.load(fs)
|
||||||
assert ('remote_daemon_urls' not in settings['chainclients']['monero'])
|
assert (len(settings['chainclients']['monero']['remote_daemon_urls']) == 0)
|
||||||
|
|
||||||
print('Test Passed!')
|
print('Test Passed!')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user