|
|
@ -98,10 +98,15 @@ def test_check_notification(client, live_server):
|
|
|
|
res = client.post(
|
|
|
|
res = client.post(
|
|
|
|
url_for("settings_page"),
|
|
|
|
url_for("settings_page"),
|
|
|
|
data={"notification_title": "New ChangeDetection.io Notification - {watch_url}",
|
|
|
|
data={"notification_title": "New ChangeDetection.io Notification - {watch_url}",
|
|
|
|
"notification_body": "{base_url}\n{watch_url}\n{preview_url}\n{diff_url}\n{current_snapshot}\n:-)",
|
|
|
|
"notification_body": "BASE URL: {base_url}\n"
|
|
|
|
|
|
|
|
"Watch URL: {watch_url}\n"
|
|
|
|
|
|
|
|
"Preview: {preview_url}\n"
|
|
|
|
|
|
|
|
"Diff URL: {diff_url}\n"
|
|
|
|
|
|
|
|
"Snapshot: {current_snapshot}\n"
|
|
|
|
|
|
|
|
":-)",
|
|
|
|
"notification_urls": "json://foobar.com", #Re #143 should not see that it sent without [test checkbox]
|
|
|
|
"notification_urls": "json://foobar.com", #Re #143 should not see that it sent without [test checkbox]
|
|
|
|
"minutes_between_check": 180,
|
|
|
|
"minutes_between_check": 180,
|
|
|
|
"fetch_backend": "html_requests",
|
|
|
|
"fetch_backend": "html_requests"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
follow_redirects=True
|
|
|
|
follow_redirects=True
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -145,3 +150,18 @@ def test_check_notification(client, live_server):
|
|
|
|
client.get(url_for("api_watch_checknow"), follow_redirects=True)
|
|
|
|
client.get(url_for("api_watch_checknow"), follow_redirects=True)
|
|
|
|
time.sleep(3)
|
|
|
|
time.sleep(3)
|
|
|
|
assert os.path.exists("test-datastore/notification.txt") == False
|
|
|
|
assert os.path.exists("test-datastore/notification.txt") == False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Now adding a wrong token should give us an error
|
|
|
|
|
|
|
|
res = client.post(
|
|
|
|
|
|
|
|
url_for("settings_page"),
|
|
|
|
|
|
|
|
data={"notification_title": "New ChangeDetection.io Notification - {watch_url}",
|
|
|
|
|
|
|
|
"notification_body": "Rubbish: {rubbish}\n",
|
|
|
|
|
|
|
|
"notification_urls": "json://foobar.com",
|
|
|
|
|
|
|
|
"minutes_between_check": 180,
|
|
|
|
|
|
|
|
"fetch_backend": "html_requests"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
follow_redirects=True
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert bytes("is not a valid token".encode('utf-8')) in res.data
|