From ef310e4a67c8d3391dd42a5e6ee8a62173c875e6 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sun, 1 Feb 2026 18:26:33 +0100 Subject: [PATCH] test tweaks --- changedetectionio/tests/fetchers/test_content.py | 9 +-------- .../tests/fetchers/test_custom_js_before_content.py | 7 +------ .../tests/proxy_list/test_multiple_proxy.py | 7 +------ changedetectionio/tests/proxy_list/test_noproxy.py | 3 +++ .../tests/proxy_list/test_proxy_noconnect.py | 6 +----- .../tests/proxy_list/test_select_custom_proxy.py | 9 +-------- .../tests/proxy_socks5/test_socks5_proxy.py | 8 ++------ .../tests/proxy_socks5/test_socks5_proxy_sources.py | 7 +------ changedetectionio/tests/smtp/test_notification_smtp.py | 8 +------- .../tests/visualselector/test_fetch_data.py | 8 +------- 10 files changed, 13 insertions(+), 59 deletions(-) diff --git a/changedetectionio/tests/fetchers/test_content.py b/changedetectionio/tests/fetchers/test_content.py index 8e9899af..c3b70017 100644 --- a/changedetectionio/tests/fetchers/test_content.py +++ b/changedetectionio/tests/fetchers/test_content.py @@ -24,15 +24,8 @@ def test_fetch_webdriver_content(client, live_server, measure_memory_usage, data ) assert b"Settings updated." in res.data + uuid = client.application.config.get('DATASTORE').add_watch(url="https://changedetection.io/ci-test.html") - # Add our URL to the import page - res = client.post( - url_for("imports.import_page"), - data={"urls": "https://changedetection.io/ci-test.html"}, - follow_redirects=True - ) - - assert b"1 Imported" in res.data wait_for_all_checks(client) res = client.get( diff --git a/changedetectionio/tests/fetchers/test_custom_js_before_content.py b/changedetectionio/tests/fetchers/test_custom_js_before_content.py index 72385ce2..9679b516 100644 --- a/changedetectionio/tests/fetchers/test_custom_js_before_content.py +++ b/changedetectionio/tests/fetchers/test_custom_js_before_content.py @@ -12,13 +12,8 @@ def test_execute_custom_js(client, live_server, measure_memory_usage, datastore_ test_url = test_url.replace('localhost.localdomain', 'cdio') test_url = test_url.replace('localhost', 'cdio') - res = client.post( - url_for("ui.ui_views.form_quick_watch_add"), - data={"url": test_url, "tags": '', 'edit_and_watch_submit_button': 'Edit > Watch'}, - follow_redirects=True - ) - assert b"Watch added in Paused state, saving will unpause" in res.data + uuid = client.application.config.get('DATASTORE').add_watch(url=test_url, extras={'paused': True}) res = client.post( url_for("ui.ui_edit.edit_page", uuid=uuid, unpause_on_save=1), diff --git a/changedetectionio/tests/proxy_list/test_multiple_proxy.py b/changedetectionio/tests/proxy_list/test_multiple_proxy.py index b6825188..520ca735 100644 --- a/changedetectionio/tests/proxy_list/test_multiple_proxy.py +++ b/changedetectionio/tests/proxy_list/test_multiple_proxy.py @@ -10,12 +10,7 @@ def test_preferred_proxy(client, live_server, measure_memory_usage, datastore_pa url = "http://chosen.changedetection.io" - res = client.post( - url_for("ui.ui_views.form_quick_watch_add"), - data={"url": url, "tags": '', 'edit_and_watch_submit_button': 'Edit > Watch'}, - follow_redirects=True - ) - assert b"Watch added in Paused state, saving will unpause" in res.data + uuid = client.application.config.get('DATASTORE').add_watch(url=url, extras={'paused': True}) wait_for_all_checks(client) res = client.post( diff --git a/changedetectionio/tests/proxy_list/test_noproxy.py b/changedetectionio/tests/proxy_list/test_noproxy.py index 2276ce47..bf379ad5 100644 --- a/changedetectionio/tests/proxy_list/test_noproxy.py +++ b/changedetectionio/tests/proxy_list/test_noproxy.py @@ -11,6 +11,9 @@ def test_noproxy_option(client, live_server, measure_memory_usage, datastore_pat # Call this URL then scan the containers that it never went through them url = "http://noproxy.changedetection.io" + + uuid = client.application.config.get('DATASTORE').add_watch(url=url, extras={'paused': True}) + # Should only be available when a proxy is setup res = client.get( url_for("ui.ui_edit.edit_page", uuid=uuid, unpause_on_save=1)) diff --git a/changedetectionio/tests/proxy_list/test_proxy_noconnect.py b/changedetectionio/tests/proxy_list/test_proxy_noconnect.py index 698ae5ce..6db0d8d0 100644 --- a/changedetectionio/tests/proxy_list/test_proxy_noconnect.py +++ b/changedetectionio/tests/proxy_list/test_proxy_noconnect.py @@ -32,11 +32,7 @@ def test_proxy_noconnect_custom(client, live_server, measure_memory_usage, datas assert b"Settings updated." in res.data test_url = "https://changedetection.io" - res = client.post( - url_for("ui.ui_views.form_quick_watch_add"), - data={"url": test_url, "tags": '', 'edit_and_watch_submit_button': 'Edit > Watch'}, - follow_redirects=True - ) + uuid = client.application.config.get('DATASTORE').add_watch(url=test_url, extras={'paused': True}) assert b"Watch added in Paused state, saving will unpause" in res.data diff --git a/changedetectionio/tests/proxy_list/test_select_custom_proxy.py b/changedetectionio/tests/proxy_list/test_select_custom_proxy.py index 232088d1..73cf0ec9 100644 --- a/changedetectionio/tests/proxy_list/test_select_custom_proxy.py +++ b/changedetectionio/tests/proxy_list/test_select_custom_proxy.py @@ -25,15 +25,8 @@ def test_select_custom(client, live_server, measure_memory_usage, datastore_path assert b"Settings updated." in res.data - res = client.post( - url_for("imports.import_page"), - # Because a URL wont show in squid/proxy logs due it being SSLed - # Use plain HTTP or a specific domain-name here - data={"urls": "https://changedetection.io/CHANGELOG.txt"}, - follow_redirects=True - ) - assert b"1 Imported" in res.data + uuid = client.application.config.get('DATASTORE').add_watch(url='https://changedetection.io/CHANGELOG.txt', extras={'paused': True}) wait_for_all_checks(client) res = client.get(url_for("watchlist.index")) diff --git a/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py b/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py index 0007b607..99c40b15 100644 --- a/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py +++ b/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py @@ -44,12 +44,8 @@ def test_socks5(client, live_server, measure_memory_usage, datastore_path): test_url = test_url.replace('localhost.localdomain', 'cdio') test_url = test_url.replace('localhost', 'cdio') - res = client.post( - url_for("ui.ui_views.form_quick_watch_add"), - data={"url": test_url, "tags": '', 'edit_and_watch_submit_button': 'Edit > Watch'}, - follow_redirects=True - ) - assert b"Watch added in Paused state, saving will unpause" in res.data + uuid = client.application.config.get('DATASTORE').add_watch(url=test_url, extras={'paused': True}) + res = client.get( url_for("ui.ui_edit.edit_page", uuid=uuid, unpause_on_save=1), diff --git a/changedetectionio/tests/proxy_socks5/test_socks5_proxy_sources.py b/changedetectionio/tests/proxy_socks5/test_socks5_proxy_sources.py index c98c3b89..7d70d04f 100644 --- a/changedetectionio/tests/proxy_socks5/test_socks5_proxy_sources.py +++ b/changedetectionio/tests/proxy_socks5/test_socks5_proxy_sources.py @@ -31,12 +31,7 @@ def test_socks5_from_proxiesjson_file(client, live_server, measure_memory_usage, res = client.get(url_for("settings.settings_page")) assert b'name="requests-proxy" type="radio" value="socks5proxy"' in res.data - res = client.post( - url_for("ui.ui_views.form_quick_watch_add"), - data={"url": test_url, "tags": '', 'edit_and_watch_submit_button': 'Edit > Watch'}, - follow_redirects=True - ) - assert b"Watch added in Paused state, saving will unpause" in res.data + uuid = client.application.config.get('DATASTORE').add_watch(url=test_url, extras={'paused': True}) res = client.get( url_for("ui.ui_edit.edit_page", uuid=uuid, unpause_on_save=1), diff --git a/changedetectionio/tests/smtp/test_notification_smtp.py b/changedetectionio/tests/smtp/test_notification_smtp.py index 4ee18c71..fd055665 100644 --- a/changedetectionio/tests/smtp/test_notification_smtp.py +++ b/changedetectionio/tests/smtp/test_notification_smtp.py @@ -377,13 +377,7 @@ def test_check_notification_email_formats_default_Text_override_HTML(client, liv # Add a watch and trigger a HTTP POST test_url = url_for('test_endpoint',content_type="text/html", _external=True) - res = client.post( - url_for("ui.ui_views.form_quick_watch_add"), - data={"url": test_url, "tags": 'nice one'}, - follow_redirects=True - ) - - assert b"Watch added" in res.data + uuid = client.application.config.get('DATASTORE').add_watch(url=test_url, tag='nice one') #################################### FIRST SITUATION, PLAIN TEXT NOTIFICATION IS WANTED BUT WE HAVE HTML IN OUR TEMPLATE AND CONTENT ########## wait_for_all_checks(client) diff --git a/changedetectionio/tests/visualselector/test_fetch_data.py b/changedetectionio/tests/visualselector/test_fetch_data.py index bb7fcfcb..c7d46a54 100644 --- a/changedetectionio/tests/visualselector/test_fetch_data.py +++ b/changedetectionio/tests/visualselector/test_fetch_data.py @@ -93,14 +93,8 @@ def test_basic_browserstep(client, live_server, measure_memory_usage, datastore_ test_url = url_for('test_interactive_html_endpoint', _external=True) test_url = test_url.replace('localhost.localdomain', 'cdio') test_url = test_url.replace('localhost', 'cdio') + uuid = client.application.config.get('DATASTORE').add_watch(url=test_url, tag='nice one', extras={'paused': True}) - res = client.post( - url_for("ui.ui_views.form_quick_watch_add"), - data={"url": test_url, "tags": '', 'edit_and_watch_submit_button': 'Edit > Watch'}, - follow_redirects=True - ) - - assert b"Watch added in Paused state, saving will unpause" in res.data res = client.post( url_for("ui.ui_edit.edit_page", uuid=uuid, unpause_on_save=1),