mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-09-15 01:47:18 +00:00
Import - Improved Wachete Excel XLS import support for "dynamic wachet" (sets correct state of using chrome browser or not) column (#1934)
This commit is contained in:
@@ -171,10 +171,12 @@ class import_xlsx_wachete(Importer):
|
||||
data[column_title] = cell.value
|
||||
|
||||
# Forced switch to webdriver/playwright/etc
|
||||
dynamic_wachet = str(data.get('dynamic wachet')).strip().lower() # Convert bool to str to cover all cases
|
||||
dynamic_wachet = str(data.get('dynamic wachet', '')).strip().lower() # Convert bool to str to cover all cases
|
||||
# libreoffice and others can have it as =FALSE() =TRUE(), or bool(true)
|
||||
if 'true' in dynamic_wachet or dynamic_wachet == '1':
|
||||
extras['fetch_backend'] = 'html_webdriver'
|
||||
elif 'false' in dynamic_wachet or dynamic_wachet == '0':
|
||||
extras['fetch_backend'] = 'html_requests'
|
||||
|
||||
if data.get('xpath'):
|
||||
# @todo split by || ?
|
||||
|
||||
Binary file not shown.
@@ -151,7 +151,7 @@ def test_import_custom_xlsx(client, live_server):
|
||||
follow_redirects=True,
|
||||
)
|
||||
|
||||
assert b'3 imported from custom .xlsx' in res.data
|
||||
assert b'4 imported from custom .xlsx' in res.data
|
||||
# Because this row was actually just a header with no usable URL, we should get an error
|
||||
assert b'Error processing row number 1' in res.data
|
||||
|
||||
@@ -191,7 +191,7 @@ def test_import_watchete_xlsx(client, live_server):
|
||||
follow_redirects=True,
|
||||
)
|
||||
|
||||
assert b'3 imported from Wachete .xlsx' in res.data
|
||||
assert b'4 imported from Wachete .xlsx' in res.data
|
||||
|
||||
res = client.get(
|
||||
url_for("index")
|
||||
@@ -206,10 +206,13 @@ def test_import_watchete_xlsx(client, live_server):
|
||||
filters = watch.get('include_filters')
|
||||
assert filters[0] == '/html[1]/body[1]/div[4]/div[1]/div[1]/div[1]||//*[@id=\'content\']/div[3]/div[1]/div[1]||//*[@id=\'content\']/div[1]'
|
||||
assert watch.get('time_between_check') == {'weeks': 0, 'days': 1, 'hours': 6, 'minutes': 24, 'seconds': 0}
|
||||
assert watch.get('fetch_backend') == 'system' # always uses default
|
||||
assert watch.get('fetch_backend') == 'html_requests' # Has inactive 'dynamic wachet'
|
||||
|
||||
if watch.get('title') == 'JS website':
|
||||
assert watch.get('fetch_backend') == 'html_webdriver' # Has active 'dynamic wachet'
|
||||
|
||||
if watch.get('title') == 'system default website':
|
||||
assert watch.get('fetch_backend') == 'system' # uses default if blank
|
||||
|
||||
res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True)
|
||||
assert b'Deleted' in res.data
|
||||
|
||||
Reference in New Issue
Block a user