mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-07-08 16:32:00 +00:00
UI - Splitting off notifications to its own tab/menu - apprise split off
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Has been cancelled
ChangeDetection.io App Test / lint-code (push) Has been cancelled
ChangeDetection.io App Test / lint-translations (push) Has been cancelled
ChangeDetection.io App Test / lint-template-i18n (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Test the built package works basically. (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-10 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-11 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-12 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-13 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-14 (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Has been cancelled
ChangeDetection.io App Test / lint-code (push) Has been cancelled
ChangeDetection.io App Test / lint-translations (push) Has been cancelled
ChangeDetection.io App Test / lint-template-i18n (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Test the built package works basically. (push) Has been cancelled
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-10 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-11 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-12 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-13 (push) Has been cancelled
ChangeDetection.io App Test / test-application-3-14 (push) Has been cancelled
This commit is contained in:
@@ -20,6 +20,14 @@ def construct_blueprint(datastore: ChangeDetectionStore):
|
||||
from changedetectionio.blueprint.settings.llm import construct_llm_blueprint
|
||||
settings_blueprint.register_blueprint(construct_llm_blueprint(datastore), url_prefix='/llm')
|
||||
|
||||
# Notification settings live in their own child blueprint so future backends
|
||||
# (simple_email, webhooks, etc.) slot in as /settings/notifications/<backend>
|
||||
# without further URL-shaping churn.
|
||||
from changedetectionio.blueprint.settings.notifications import construct_notifications_blueprint
|
||||
settings_blueprint.register_blueprint(
|
||||
construct_notifications_blueprint(datastore), url_prefix='/notifications',
|
||||
)
|
||||
|
||||
@settings_blueprint.route("", methods=['GET', "POST"])
|
||||
@login_optionally_required
|
||||
def settings_page():
|
||||
@@ -277,46 +285,6 @@ def construct_blueprint(datastore: ChangeDetectionStore):
|
||||
flash(gettext("API Key was regenerated."))
|
||||
return redirect(url_for('settings.settings_page')+'#api')
|
||||
|
||||
@settings_blueprint.route("/notifications", methods=['GET', 'POST'])
|
||||
@login_optionally_required
|
||||
def notifications_page():
|
||||
from changedetectionio import forms
|
||||
|
||||
app_settings = datastore.data['settings']['application']
|
||||
# Seed the form with the currently stored values so GET (and a failed
|
||||
# POST that re-renders) shows what's persisted, not WTForms defaults.
|
||||
default = {
|
||||
'notification_urls': app_settings.get('notification_urls') or [],
|
||||
'notification_title': app_settings.get('notification_title') or '',
|
||||
'notification_body': app_settings.get('notification_body') or '',
|
||||
'notification_format': app_settings.get('notification_format') or '',
|
||||
'base_url': app_settings.get('base_url') or '',
|
||||
}
|
||||
|
||||
form = forms.globalSettingsNotificationForm(
|
||||
formdata=request.form if request.method == 'POST' else None,
|
||||
data=default,
|
||||
extra_notification_tokens=datastore.get_unique_notification_tokens_available(),
|
||||
)
|
||||
|
||||
if request.method == 'POST' and form.validate():
|
||||
for field in ('notification_urls', 'notification_title', 'notification_body',
|
||||
'notification_format', 'base_url'):
|
||||
app_settings[field] = form.data.get(field)
|
||||
datastore.commit()
|
||||
flash(gettext("Settings updated."))
|
||||
return redirect(url_for('settings.notifications_page'))
|
||||
elif request.method == 'POST':
|
||||
flash(gettext("An error occurred, please see below."), "error")
|
||||
|
||||
return render_template(
|
||||
"notifications.html",
|
||||
form=form,
|
||||
emailprefix=os.getenv('NOTIFICATION_MAIL_BUTTON_PREFIX', False),
|
||||
extra_notification_token_placeholder_info=datastore.get_unique_notification_token_placeholders_available(),
|
||||
settings_application=app_settings,
|
||||
)
|
||||
|
||||
@settings_blueprint.route("/notification-logs", methods=['GET'])
|
||||
@login_optionally_required
|
||||
def notification_logs():
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
"""
|
||||
Notification settings — child blueprint of /settings.
|
||||
|
||||
Registered by the parent settings blueprint at url_prefix='/notifications', so the
|
||||
URLs land at /settings/notifications/<backend>. Today the only backend is apprise;
|
||||
future backends (simple_email, raw webhooks, etc.) slot in as sibling routes here
|
||||
without re-shaping the URL space again.
|
||||
|
||||
The eventual data-model refactor is to give each notification config its own
|
||||
uuid (`notification_uuid`) referenced from global/watch/group settings, instead
|
||||
of inlining apprise URL strings on every record — that's not done here; this
|
||||
file just gives that future work a stable home.
|
||||
"""
|
||||
import os
|
||||
|
||||
from flask import Blueprint, render_template, request, redirect, url_for, flash
|
||||
from flask_babel import gettext
|
||||
|
||||
from changedetectionio.store import ChangeDetectionStore
|
||||
from changedetectionio.auth_decorator import login_optionally_required
|
||||
|
||||
|
||||
def construct_notifications_blueprint(datastore: ChangeDetectionStore):
|
||||
notifications_blueprint = Blueprint(
|
||||
'notifications', __name__,
|
||||
template_folder="templates",
|
||||
)
|
||||
|
||||
@notifications_blueprint.route("/", methods=['GET'])
|
||||
@login_optionally_required
|
||||
def index():
|
||||
# /settings/notifications/ → apprise (only backend for now).
|
||||
# When a second backend lands this becomes a chooser.
|
||||
return redirect(url_for('settings.notifications.apprise'))
|
||||
|
||||
@notifications_blueprint.route("/apprise", methods=['GET', 'POST'])
|
||||
@login_optionally_required
|
||||
def apprise():
|
||||
from changedetectionio import forms
|
||||
|
||||
app_settings = datastore.data['settings']['application']
|
||||
# Seed the form with the currently stored values so GET (and a failed
|
||||
# POST that re-renders) shows what's persisted, not WTForms defaults.
|
||||
default = {
|
||||
'notification_urls': app_settings.get('notification_urls') or [],
|
||||
'notification_title': app_settings.get('notification_title') or '',
|
||||
'notification_body': app_settings.get('notification_body') or '',
|
||||
'notification_format': app_settings.get('notification_format') or '',
|
||||
'base_url': app_settings.get('base_url') or '',
|
||||
}
|
||||
|
||||
form = forms.globalSettingsAppriseNotificationForm(
|
||||
formdata=request.form if request.method == 'POST' else None,
|
||||
data=default,
|
||||
extra_notification_tokens=datastore.get_unique_notification_tokens_available(),
|
||||
)
|
||||
|
||||
if request.method == 'POST' and form.validate():
|
||||
for field in ('notification_urls', 'notification_title', 'notification_body',
|
||||
'notification_format', 'base_url'):
|
||||
app_settings[field] = form.data.get(field)
|
||||
datastore.commit()
|
||||
flash(gettext("Settings updated."))
|
||||
return redirect(url_for('settings.notifications.apprise'))
|
||||
elif request.method == 'POST':
|
||||
flash(gettext("An error occurred, please see below."), "error")
|
||||
|
||||
return render_template(
|
||||
"apprise.html",
|
||||
form=form,
|
||||
emailprefix=os.getenv('NOTIFICATION_MAIL_BUTTON_PREFIX', False),
|
||||
extra_notification_token_placeholder_info=datastore.get_unique_notification_token_placeholders_available(),
|
||||
settings_application=app_settings,
|
||||
)
|
||||
|
||||
return notifications_blueprint
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box-wrap inner">
|
||||
<form class="pure-form pure-form-stacked settings" action="{{url_for('settings.notifications_page')}}" method="POST">
|
||||
<form class="pure-form pure-form-stacked settings" action="{{url_for('settings.notifications.apprise')}}" method="POST">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" >
|
||||
<div class="tab-pane-inner" id="all-notifications">
|
||||
<fieldset>
|
||||
@@ -131,7 +131,7 @@
|
||||
{% if has_default_notification_urls %}
|
||||
<div class="inline-warning">
|
||||
<img class="inline-warning-icon" src="{{url_for('static_content', group='images', filename='notice.svg')}}" alt="{{ _('Look out!') }}" title="{{ _('Lookout!') }}" >
|
||||
{{ _('There are <a href="%(url)s">system-wide notification URLs enabled</a>, this form will override notification settings for this watch only ‐ an empty Notification URL list here will still send notifications.', url=url_for('settings.notifications_page'))|safe }}
|
||||
{{ _('There are <a href="%(url)s">system-wide notification URLs enabled</a>, this form will override notification settings for this watch only ‐ an empty Notification URL list here will still send notifications.', url=url_for('settings.notifications.apprise'))|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<a href="#notifications" id="notification-setting-reset-to-default" class="pure-button button-xsmall" style="right: 20px; top: 20px; position: absolute; background-color: #5f42dd; border-radius: 4px; font-size: 70%; color: #fff">{{ _('Use system defaults') }}</a>
|
||||
|
||||
@@ -299,7 +299,7 @@ Math: {{ 1 + 1 }}") }}
|
||||
{% if has_default_notification_urls %}
|
||||
<div class="inline-warning">
|
||||
<img class="inline-warning-icon" src="{{url_for('static_content', group='images', filename='notice.svg')}}" alt="{{ _('Look out!') }}" title="{{ _('Lookout!') }}" >
|
||||
{{ _('There are <a href="%(url)s">system-wide notification URLs enabled</a>, this form will override notification settings for this watch only ‐ an empty Notification URL list here will still send notifications.', url=url_for('settings.notifications_page'))|safe }}
|
||||
{{ _('There are <a href="%(url)s">system-wide notification URLs enabled</a>, this form will override notification settings for this watch only ‐ an empty Notification URL list here will still send notifications.', url=url_for('settings.notifications.apprise'))|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<a href="#notifications" id="notification-setting-reset-to-default" class="pure-button button-xsmall" style="right: 20px; top: 20px; position: absolute; background-color: #5f42dd; border-radius: 4px; font-size: 70%; color: #fff">{{ _('Use system defaults') }}</a>
|
||||
|
||||
@@ -809,15 +809,19 @@ class commonSettingsForm(Form):
|
||||
# raise ValidationError('HTML Color format is not supported by Telegram and Discord. Please choose another Notification Format (Plain Text, HTML, or Markdown to HTML).')
|
||||
|
||||
|
||||
# Standalone form for the /settings/notifications page. Holds only the global
|
||||
# notification fields (the macro `notification_part_render_common_settings_form`
|
||||
# in _common_fields.html expects these exact field names) plus base_url, which
|
||||
# powers the {{base_url}} token in notification templates.
|
||||
# Standalone form for the /settings/notifications/apprise page. Holds only the
|
||||
# global apprise-notification fields (the macro
|
||||
# `notification_part_render_common_settings_form` in _common_fields.html expects
|
||||
# these exact field names) plus base_url, which powers the {{base_url}} token
|
||||
# in notification templates.
|
||||
#
|
||||
# This is intentionally not a sub-form of globalSettingsForm — the notifications
|
||||
# page POSTs to its own route so the broader settings form's validators (worker
|
||||
# count, RSS limits, etc.) don't run when the user only wants to tweak alerts.
|
||||
class globalSettingsNotificationForm(Form):
|
||||
#
|
||||
# Named for the backend (apprise) on purpose: future backends (simple_email,
|
||||
# webhook, etc.) will land as their own forms next to this one.
|
||||
class globalSettingsAppriseNotificationForm(Form):
|
||||
def __init__(self, formdata=None, obj=None, prefix="", data=None, meta=None, **kwargs):
|
||||
super().__init__(formdata, obj, prefix, data, meta, **kwargs)
|
||||
extra = kwargs.get('extra_notification_tokens', {})
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="action-sidebar-li">
|
||||
<a href="{{ url_for('settings.notifications_page') }}"
|
||||
<a href="{{ url_for('settings.notifications.apprise') }}"
|
||||
class="action-sidebar-item"
|
||||
title="{{ _('Notifications') }}">
|
||||
<svg class="action-icon" viewBox="0 0 24 24" aria-hidden="true">
|
||||
|
||||
@@ -28,7 +28,7 @@ def test_check_notification(client, live_server, measure_memory_usage, datastore
|
||||
|
||||
# Re 360 - new install should have defaults set
|
||||
# Notification UI lives on its own page since the global settings refactor.
|
||||
res = client.get(url_for("settings.notifications_page"))
|
||||
res = client.get(url_for("settings.notifications.apprise"))
|
||||
notification_url = url_for('test_notification_endpoint', _external=True).replace('http', 'json')+"?status_code=204"
|
||||
|
||||
assert default_notification_body.encode() in res.data
|
||||
@@ -37,7 +37,7 @@ def test_check_notification(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.notifications_page"),
|
||||
url_for("settings.notifications.apprise"),
|
||||
data={"notification_urls": notification_url,
|
||||
"notification_title": "fallback-title "+default_notification_title,
|
||||
"notification_body": "fallback-body "+default_notification_body,
|
||||
@@ -47,7 +47,7 @@ def test_check_notification(client, live_server, measure_memory_usage, datastore
|
||||
|
||||
assert b"Settings updated." in res.data
|
||||
|
||||
res = client.get(url_for("settings.notifications_page"))
|
||||
res = client.get(url_for("settings.notifications.apprise"))
|
||||
for k,v in valid_notification_formats.items():
|
||||
if k == USE_SYSTEM_DEFAULT_NOTIFICATION_FORMAT_FOR_WATCH:
|
||||
continue
|
||||
@@ -59,7 +59,7 @@ def test_check_notification(client, live_server, measure_memory_usage, datastore
|
||||
env_base_url = os.getenv('BASE_URL', '').strip()
|
||||
if len(env_base_url):
|
||||
logging.debug(">>> BASE_URL enabled, looking for %s", env_base_url)
|
||||
res = client.get(url_for("settings.notifications_page"))
|
||||
res = client.get(url_for("settings.notifications.apprise"))
|
||||
assert bytes(env_base_url.encode('utf-8')) in res.data
|
||||
else:
|
||||
logging.debug(">>> SKIPPING BASE_URL check")
|
||||
@@ -279,7 +279,7 @@ def test_notification_urls_jinja2_apprise_integration(client, live_server, measu
|
||||
test_notification_url = "hassio://127.0.0.1/longaccesstoken?verify=no&nid={{watch_uuid}}"
|
||||
|
||||
res = client.post(
|
||||
url_for("settings.notifications_page"),
|
||||
url_for("settings.notifications.apprise"),
|
||||
data={
|
||||
"notification_body": '{ "url" : "{{ watch_url }}", "secret": 444, "somebug": "网站监测 内容更新了", "another": "{{diff|truncate(1500)}}" }',
|
||||
"notification_format": default_notification_format,
|
||||
@@ -309,7 +309,7 @@ def test_notification_custom_endpoint_and_jinja2(client, live_server, measure_me
|
||||
test_notification_url = url_for('test_notification_endpoint', _external=True).replace('http://', 'post://')+"?status_code=204&watch_uuid={{ watch_uuid }}&xxx={{ watch_url }}&now={% now 'Europe/London', '%Y-%m-%d' %}&+custom-header=123&+second=hello+world%20%22space%22"
|
||||
|
||||
res = client.post(
|
||||
url_for("settings.notifications_page"),
|
||||
url_for("settings.notifications.apprise"),
|
||||
data={
|
||||
"notification_body": '{ "url" : "{{ watch_url }}", "secret": 444, "somebug": "网站监测 内容更新了" }',
|
||||
"notification_format": default_notification_format,
|
||||
@@ -392,7 +392,7 @@ def test_global_send_test_notification(client, live_server, measure_memory_usage
|
||||
|
||||
# otherwise other settings would have already existed from previous tests in this file
|
||||
res = client.post(
|
||||
url_for("settings.notifications_page"),
|
||||
url_for("settings.notifications.apprise"),
|
||||
data={
|
||||
"notification_body": test_body,
|
||||
"notification_format": default_notification_format,
|
||||
@@ -580,7 +580,7 @@ def _test_color_notifications(client, notification_body_token, datastore_path):
|
||||
|
||||
# otherwise other settings would have already existed from previous tests in this file
|
||||
res = client.post(
|
||||
url_for("settings.notifications_page"),
|
||||
url_for("settings.notifications.apprise"),
|
||||
data={
|
||||
"notification_body": notification_body_token,
|
||||
"notification_format": "htmlcolor",
|
||||
@@ -652,7 +652,7 @@ def _test_custom_html_in_notification_body_not_escaped(client, datastore_path, c
|
||||
test_url = url_for('test_endpoint', _external=True, **kwargs)
|
||||
|
||||
res = client.post(
|
||||
url_for("settings.notifications_page"),
|
||||
url_for("settings.notifications.apprise"),
|
||||
data={
|
||||
"notification_body": '<a href="{{watch_url}}">Watch Link</a> had changes\n\n{{diff}}',
|
||||
"notification_format": "htmlcolor",
|
||||
@@ -730,7 +730,7 @@ def test_html_watch_diff_content_escaped_in_html_notification(client, live_serve
|
||||
# HTML-format notification body that embeds the snapshot directly. Operators do this
|
||||
# when they want the full changed content in the alert (e.g. an email digest).
|
||||
res = client.post(
|
||||
url_for("settings.notifications_page"),
|
||||
url_for("settings.notifications.apprise"),
|
||||
data={
|
||||
"notification_body": 'Watch had changes:\n{{current_snapshot}}',
|
||||
"notification_format": "html",
|
||||
@@ -808,7 +808,7 @@ def test_source_url_diff_content_escaped_in_html_notification(client, live_serve
|
||||
test_url = 'source:' + url_for('test_endpoint', _external=True, content_type='text/html')
|
||||
|
||||
res = client.post(
|
||||
url_for("settings.notifications_page"),
|
||||
url_for("settings.notifications.apprise"),
|
||||
data={
|
||||
"notification_body": 'Watch had changes:\n{{current_snapshot}}',
|
||||
"notification_format": "html",
|
||||
|
||||
@@ -33,7 +33,7 @@ def test_notifications_page_renders_form_inputs(
|
||||
Scans for each field's `name="..."` attribute (widget-agnostic — works for
|
||||
StringField/TextAreaField/SelectField/StringListField alike) plus the
|
||||
submit button and the notifications.js wiring."""
|
||||
res = client.get(url_for('settings.notifications_page'))
|
||||
res = client.get(url_for('settings.notifications.apprise'))
|
||||
assert res.status_code == 200
|
||||
body = res.data.decode('utf-8', errors='replace')
|
||||
|
||||
@@ -43,8 +43,8 @@ def test_notifications_page_renders_form_inputs(
|
||||
f"Form input for {field!r} missing from /settings/notifications HTML"
|
||||
|
||||
# Submit form actually wired to the right route
|
||||
assert f'action="{url_for("settings.notifications_page")}"' in body, \
|
||||
"Form should POST back to /settings/notifications"
|
||||
assert f'action="{url_for("settings.notifications.apprise")}"' in body, \
|
||||
"Form should POST back to /settings/notifications/apprise"
|
||||
|
||||
# notifications.js needs the JS-side ajax endpoint to test sends from this page
|
||||
assert 'notification_base_url' in body, \
|
||||
@@ -72,7 +72,7 @@ def test_notifications_page_get_renders_stored_values(
|
||||
ds = client.application.config.get('DATASTORE')
|
||||
_seed_notification_config(ds)
|
||||
|
||||
res = client.get(url_for('settings.notifications_page'))
|
||||
res = client.get(url_for('settings.notifications.apprise'))
|
||||
assert res.status_code == 200
|
||||
body = res.data.decode('utf-8', errors='replace')
|
||||
|
||||
@@ -91,7 +91,7 @@ def test_notifications_page_post_saves_values(
|
||||
ds = client.application.config.get('DATASTORE')
|
||||
|
||||
res = client.post(
|
||||
url_for('settings.notifications_page'),
|
||||
url_for('settings.notifications.apprise'),
|
||||
data={
|
||||
'notification_urls': 'json://example.invalid/new',
|
||||
'notification_title': 'New title - {{ watch_url }}',
|
||||
@@ -173,14 +173,36 @@ def test_notifications_page_save_does_not_clobber_other_settings(
|
||||
"""
|
||||
Inverse of the above — saving notifications must NOT reach over and zero
|
||||
out unrelated application settings (pager_size, fetch_backend, etc.).
|
||||
|
||||
The notifications-page handler explicitly writes a known list of five
|
||||
notification fields rather than doing app.update(form.data) — this test
|
||||
pins that behaviour so a refactor that switches to .update() (which would
|
||||
silently zero out every non-notification key) fails loudly here.
|
||||
"""
|
||||
ds = client.application.config.get('DATASTORE')
|
||||
app = ds.data['settings']['application']
|
||||
app['pager_size'] = 42
|
||||
app['fetch_backend'] = 'html_requests'
|
||||
# Plant a representative mix of application-level fields: ints, lists,
|
||||
# strings, bools, nested dicts. If the notifications save ever does a
|
||||
# blanket .update(form.data) it'll wipe these to WTForms defaults and
|
||||
# the per-field asserts below will catch it.
|
||||
untouched_snapshot = {
|
||||
'pager_size': 73,
|
||||
'fetch_backend': 'html_requests',
|
||||
'rss_diff_length': 9,
|
||||
'filter_failure_notification_threshold_attempts': 4,
|
||||
'global_ignore_text': ['SENTINEL-IGNORE-LINE'],
|
||||
'global_subtractive_selectors': ['nav.SENTINEL-SUB'],
|
||||
'ignore_whitespace': True,
|
||||
'render_anchor_tag_content': True,
|
||||
'shared_diff_access': True,
|
||||
'api_access_token_enabled': False,
|
||||
'scheduler_timezone_default': 'Europe/Berlin',
|
||||
}
|
||||
for k, v in untouched_snapshot.items():
|
||||
app[k] = v
|
||||
|
||||
res = client.post(
|
||||
url_for('settings.notifications_page'),
|
||||
url_for('settings.notifications.apprise'),
|
||||
data={
|
||||
'notification_urls': 'json://example.invalid/only-this',
|
||||
'notification_title': '',
|
||||
@@ -191,7 +213,15 @@ def test_notifications_page_save_does_not_clobber_other_settings(
|
||||
follow_redirects=True,
|
||||
)
|
||||
assert res.status_code == 200
|
||||
assert b'Settings updated.' in res.data, \
|
||||
"Notification save did not reach the success branch — test setup is wrong"
|
||||
|
||||
# Unrelated fields must be untouched.
|
||||
assert ds.data['settings']['application'].get('pager_size') == 42
|
||||
assert ds.data['settings']['application'].get('fetch_backend') == 'html_requests'
|
||||
# Every planted field must have survived the notifications save bit-for-bit.
|
||||
for k, expected in untouched_snapshot.items():
|
||||
actual = ds.data['settings']['application'].get(k)
|
||||
assert actual == expected, \
|
||||
f"Notification save clobbered unrelated setting {k!r}: expected {expected!r}, got {actual!r}"
|
||||
|
||||
# And the notification field we DID submit was actually written.
|
||||
assert ds.data['settings']['application'].get('notification_urls') == \
|
||||
['json://example.invalid/only-this']
|
||||
|
||||
Reference in New Issue
Block a user