diff --git a/changedetectionio/tests/restock/test_restock.py b/changedetectionio/tests/restock/test_restock.py index aaaf5605f..c62deb70e 100644 --- a/changedetectionio/tests/restock/test_restock.py +++ b/changedetectionio/tests/restock/test_restock.py @@ -62,13 +62,11 @@ def test_restock_detection(client, live_server, measure_memory_usage, datastore_ ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title "+default_notification_title, - "application-notification_body": "fallback-body "+default_notification_body, - "application-notification_format": default_notification_format, - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_webdriver"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title "+default_notification_title, + "notification_body": "fallback-body "+default_notification_body, + "notification_format": default_notification_format}, follow_redirects=True ) # Add our URL to the import page, because the docker container (playwright/selenium) wont be able to connect to our usual test url diff --git a/changedetectionio/tests/smtp/test_notification_smtp.py b/changedetectionio/tests/smtp/test_notification_smtp.py index a163c6f67..549b364a7 100644 --- a/changedetectionio/tests/smtp/test_notification_smtp.py +++ b/changedetectionio/tests/smtp/test_notification_smtp.py @@ -51,13 +51,11 @@ def test_check_notification_email_formats_default_HTML(client, live_server, meas ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title " + default_notification_title, - "application-notification_body": "some text\nfallback-body
" + default_notification_body, - "application-notification_format": 'html', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title " + default_notification_title, + "notification_body": "some text\nfallback-body
" + default_notification_body, + "notification_format": 'html'}, follow_redirects=True ) assert b"Settings updated." in res.data @@ -123,13 +121,11 @@ def test_check_notification_plaintext_format(client, live_server, measure_memory ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title {{watch_title}} {{ diff_added.splitlines()[0] if diff_added else 'diff added didnt split' }} " + default_notification_title, - "application-notification_body": f"some text\n" + default_notification_body + f"\nMore output test\n{ALL_MARKUP_TOKENS}", - "application-notification_format": 'text', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title {{watch_title}} {{ diff_added.splitlines()[0] if diff_added else 'diff added didnt split' }} " + default_notification_title, + "notification_body": f"some text\n" + default_notification_body + f"\nMore output test\n{ALL_MARKUP_TOKENS}", + "notification_format": 'text'}, follow_redirects=True ) @@ -185,13 +181,11 @@ def test_check_notification_html_color_format(client, live_server, measure_memor ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title {{watch_title}} - diff_added_lines_test : '{{ diff_added.splitlines()[0] if diff_added else 'diff added didnt split' }}' " + default_notification_title, - "application-notification_body": f"some text\n{default_notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", - "application-notification_format": 'htmlcolor', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title {{watch_title}} - diff_added_lines_test : '{{ diff_added.splitlines()[0] if diff_added else 'diff added didnt split' }}' " + default_notification_title, + "notification_body": f"some text\n{default_notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", + "notification_format": 'htmlcolor'}, follow_redirects=True ) @@ -270,13 +264,11 @@ def test_check_notification_markdown_format(client, live_server, measure_memory_ ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title diff_added_lines_test : '{{ diff_added.splitlines()[0] if diff_added else 'diff added didnt split' }}' " + default_notification_title, - "application-notification_body": "*header*\n\nsome text\n" + default_notification_body, - "application-notification_format": 'markdown', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title diff_added_lines_test : '{{ diff_added.splitlines()[0] if diff_added else 'diff added didnt split' }}' " + default_notification_title, + "notification_body": "*header*\n\nsome text\n" + default_notification_body, + "notification_format": 'markdown'}, follow_redirects=True ) @@ -366,13 +358,11 @@ def test_check_notification_email_formats_default_Text_override_HTML(client, liv ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title " + default_notification_title, - "application-notification_body": notification_body, - "application-notification_format": 'text', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title " + default_notification_title, + "notification_body": notification_body, + "notification_format": 'text'}, follow_redirects=True ) assert b"Settings updated." in res.data @@ -478,13 +468,11 @@ def test_check_plaintext_document_plaintext_notification_smtp(client, live_serve ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title " + default_notification_title, - "application-notification_body": f"{notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", - "application-notification_format": 'text', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title " + default_notification_title, + "notification_body": f"{notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", + "notification_format": 'text'}, follow_redirects=True ) assert b"Settings updated." in res.data @@ -531,13 +519,11 @@ def test_check_plaintext_document_html_notifications(client, live_server, measur ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title " + default_notification_title, - "application-notification_body": f"{notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", - "application-notification_format": 'html', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title " + default_notification_title, + "notification_body": f"{notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", + "notification_format": 'html'}, follow_redirects=True ) assert b"Settings updated." in res.data @@ -611,13 +597,11 @@ def test_check_plaintext_document_html_color_notifications(client, live_server, ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title " + default_notification_title, - "application-notification_body": f"{notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", - "application-notification_format": 'htmlcolor', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title " + default_notification_title, + "notification_body": f"{notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", + "notification_format": 'htmlcolor'}, follow_redirects=True ) @@ -684,13 +668,11 @@ def test_check_html_document_plaintext_notification(client, live_server, measure ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title " + default_notification_title, - "application-notification_body": f"{notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", - "application-notification_format": 'text', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title " + default_notification_title, + "notification_body": f"{notification_body}\nMore output test\n{ALL_MARKUP_TOKENS}", + "notification_format": 'text'}, follow_redirects=True ) @@ -738,13 +720,11 @@ def test_check_html_notification_with_apprise_format_is_html(client, live_server ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "fallback-title " + default_notification_title, - "application-notification_body": "some text\nfallback-body
" + default_notification_body, - "application-notification_format": 'html', - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "fallback-title " + default_notification_title, + "notification_body": "some text\nfallback-body
" + default_notification_body, + "notification_format": 'html'}, follow_redirects=True ) assert b"Settings updated." in res.data diff --git a/changedetectionio/tests/test_add_replace_remove_filter.py b/changedetectionio/tests/test_add_replace_remove_filter.py index 5f715e332..32fb3b8ab 100644 --- a/changedetectionio/tests/test_add_replace_remove_filter.py +++ b/changedetectionio/tests/test_add_replace_remove_filter.py @@ -120,15 +120,13 @@ def test_check_add_line_contains_trigger(client, live_server, measure_memory_usa test_notification_url = url_for('test_notification_endpoint', _external=True).replace('http://', 'post://') + "?xxx={{ watch_url }}" res = client.post( - url_for("settings.settings_page"), - data={"application-notification_title": "New ChangeDetection.io Notification - {{ watch_url }}", + url_for("settings.notifications.apprise"), + data={"notification_title": "New ChangeDetection.io Notification - {{ watch_url }}", # triggered_text will contain multiple lines - "application-notification_body": 'triggered text was -{{triggered_text}}- ### 网站监测 内容更新了 ####', + "notification_body": 'triggered text was -{{triggered_text}}- ### 网站监测 内容更新了 ####', # https://github.com/caronc/apprise/wiki/Notify_Custom_JSON#get-parameter-manipulation - "application-notification_urls": test_notification_url, - "application-notification_format": 'text', - "application-minutes_between_check": 180, - "application-fetch_backend": "html_requests" + "notification_urls": test_notification_url, + "notification_format": 'text', }, follow_redirects=True ) diff --git a/changedetectionio/tests/test_restock_itemprop.py b/changedetectionio/tests/test_restock_itemprop.py index 352825fd7..e9c134f63 100644 --- a/changedetectionio/tests/test_restock_itemprop.py +++ b/changedetectionio/tests/test_restock_itemprop.py @@ -346,9 +346,10 @@ def test_change_with_notification_values(client, live_server, measure_memory_usa # A change in price, should trigger a change by default wait_for_all_checks(client) - # Should see new tokens register - res = client.get(url_for("settings.settings_page")) - + # Should see new tokens register — the placeholder table lives on the + # notifications page now (post-/settings refactor). + res = client.get(url_for("settings.notifications.apprise")) + assert b'{{restock.original_price}}' in res.data assert b'{{restock.previous_price}}' in res.data assert b'Original price at first check' in res.data @@ -356,13 +357,11 @@ def test_change_with_notification_values(client, live_server, measure_memory_usa ##################### # Set this up for when we remove the notification from the watch, it should fallback with these details res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": notification_url, - "application-notification_title": "title new price {{restock.price}}", - "application-notification_body": "new price {{restock.price}} previous price {{restock.previous_price}} instock {{restock.in_stock}}", - "application-notification_format": default_notification_format, - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": notification_url, + "notification_title": "title new price {{restock.price}}", + "notification_body": "new price {{restock.price}} previous price {{restock.previous_price}} instock {{restock.in_stock}}", + "notification_format": default_notification_format}, follow_redirects=True ) diff --git a/changedetectionio/tests/test_rss_single_watch.py b/changedetectionio/tests/test_rss_single_watch.py index fc7128cb9..bf43fd353 100644 --- a/changedetectionio/tests/test_rss_single_watch.py +++ b/changedetectionio/tests/test_rss_single_watch.py @@ -271,14 +271,12 @@ def test_rss_single_watch_follow_notification_body(client, live_server, measure_ res = client.post( - url_for("settings.settings_page"), + url_for("settings.notifications.apprise"), data={ - "application-fetch_backend": "html_requests", - "application-minutes_between_check": 180, - "application-notification_body": 'Boo yeah hello from main settings notification body
\nTitle: {{ watch_title }} changed', - "application-notification_format": default_notification_format, + "notification_body": 'Boo yeah hello from main settings notification body
\nTitle: {{ watch_title }} changed', + "notification_format": default_notification_format, "application-rss_template_type" : 'notification_body', - "application-notification_urls": "", + "notification_urls": "", }, follow_redirects=True diff --git a/changedetectionio/tests/test_security.py b/changedetectionio/tests/test_security.py index ab3936096..c722091d5 100644 --- a/changedetectionio/tests/test_security.py +++ b/changedetectionio/tests/test_security.py @@ -237,13 +237,11 @@ def test_xss(client, live_server, measure_memory_usage, datastore_path): ) # the template helpers were named .jinja which meant they were not having jinja2 autoescape enabled. res = client.post( - url_for("settings.settings_page"), - data={"application-notification_urls": '">', - "application-notification_title": '">', - "application-notification_body": '">', - "application-notification_format": default_notification_format, - "requests-time_between_check-minutes": 180, - 'application-fetch_backend': "html_requests"}, + url_for("settings.notifications.apprise"), + data={"notification_urls": '">', + "notification_title": '">', + "notification_body": '">', + "notification_format": default_notification_format}, follow_redirects=True )