diff --git a/changedetectionio/importer.py b/changedetectionio/importer.py index 60e494e0..c1eda44d 100644 --- a/changedetectionio/importer.py +++ b/changedetectionio/importer.py @@ -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 || ? diff --git a/changedetectionio/tests/import/spreadsheet.xlsx b/changedetectionio/tests/import/spreadsheet.xlsx index b7f33db2..d25b933b 100644 Binary files a/changedetectionio/tests/import/spreadsheet.xlsx and b/changedetectionio/tests/import/spreadsheet.xlsx differ diff --git a/changedetectionio/tests/test_import.py b/changedetectionio/tests/test_import.py index e8c66726..ed080e0e 100644 --- a/changedetectionio/tests/test_import.py +++ b/changedetectionio/tests/test_import.py @@ -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