Re #242 - app was treating notification field defaults as the field value (#244)

pull/228/head
dgtlmoon 3 years ago committed by GitHub
parent cb8fa2583a
commit cd7df86f54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -89,8 +89,7 @@ def populate_form_from_watch(form, watch):
if i[0] != '_':
p = getattr(form, i)
if hasattr(p, 'data') and i in watch:
if not p.data:
setattr(p, "data", watch[i])
setattr(p, "data", watch[i])
# We use the whole watch object from the store/JSON so we can see if there's some related status in terms of a thread
@ -440,9 +439,8 @@ def changedetection_app(config=None, datastore_o=None):
if len(datastore.data['watching'][uuid]['history']):
update_obj['previous_md5'] = get_current_checksum_include_ignore_text(uuid=uuid)
datastore.data['watching'][uuid].update(update_obj)
datastore.needs_write = True
flash("Updated watch.")
# Queue the watch for immediate recheck

@ -14,14 +14,16 @@ def test_check_notification(client, live_server):
# Give the endpoint time to spin up
time.sleep(3)
# re #242 - when you edited an existing new entry, it would not correctly show the notification settings
# Add our URL to the import page
test_url = url_for('test_endpoint', _external=True)
res = client.post(
url_for("import_page"),
data={"urls": test_url},
url_for("api_watch_add"),
data={"url": test_url, "tag": ''},
follow_redirects=True
)
assert b"1 Imported" in res.data
assert b"Watch added" in res.data
# Give the thread time to pick up the first version
time.sleep(3)
@ -61,6 +63,10 @@ def test_check_notification(client, live_server):
url_for("edit_page", uuid="first"))
assert bytes(notification_url.encode('utf-8')) in res.data
# Re #242 - wasnt saving?
assert bytes("New ChangeDetection.io Notification".encode('utf-8')) in res.data
# Because we hit 'send test notification on save'
time.sleep(3)

Loading…
Cancel
Save