UI/Functionality - Ability to manage/apply filters and notifications across tags/groups

This commit is contained in:
dgtlmoon
2023-06-19 23:29:13 +02:00
committed by GitHub
parent 72311fb845
commit 52f2c00308
49 changed files with 1161 additions and 331 deletions

View File

@@ -3,7 +3,7 @@ import os
import time
import re
from flask import url_for
from . util import set_original_response, set_modified_response, set_more_modified_response, live_server_setup
from .util import set_original_response, set_modified_response, set_more_modified_response, live_server_setup, wait_for_all_checks
from . util import extract_UUID_from_client
import logging
import base64
@@ -21,10 +21,11 @@ def test_setup(live_server):
# Hard to just add more live server URLs when one test is already running (I think)
# So we add our test here (was in a different file)
def test_check_notification(client, live_server):
#live_server_setup(live_server)
set_original_response()
# Give the endpoint time to spin up
time.sleep(3)
time.sleep(1)
# Re 360 - new install should have defaults set
res = client.get(url_for("settings_page"))
@@ -62,13 +63,13 @@ def test_check_notification(client, live_server):
test_url = url_for('test_endpoint', _external=True)
res = client.post(
url_for("form_quick_watch_add"),
data={"url": test_url, "tag": ''},
data={"url": test_url, "tags": ''},
follow_redirects=True
)
assert b"Watch added" in res.data
# Give the thread time to pick up the first version
time.sleep(3)
wait_for_all_checks(client)
# We write the PNG to disk, but a JPEG should appear in the notification
# Write the last screenshot png
@@ -105,7 +106,7 @@ def test_check_notification(client, live_server):
notification_form_data.update({
"url": test_url,
"tag": "my tag",
"tags": "my tag, my second tag",
"title": "my title",
"headers": "",
"fetch_backend": "html_requests"})
@@ -128,7 +129,7 @@ def test_check_notification(client, live_server):
## Now recheck, and it should have sent the notification
time.sleep(3)
wait_for_all_checks(client)
set_modified_response()
# Trigger a check
@@ -150,7 +151,7 @@ def test_check_notification(client, live_server):
assert "b'" not in notification_submission
assert re.search('Watch UUID: [0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}', notification_submission, re.IGNORECASE)
assert "Watch title: my title" in notification_submission
assert "Watch tag: my tag" in notification_submission
assert "Watch tag: my tag, my second tag" in notification_submission
assert "diff/" in notification_submission
assert "preview/" in notification_submission
assert ":-)" in notification_submission
@@ -193,11 +194,11 @@ def test_check_notification(client, live_server):
# Trigger a check
client.get(url_for("form_watch_checknow"), follow_redirects=True)
time.sleep(1)
wait_for_all_checks(client)
client.get(url_for("form_watch_checknow"), follow_redirects=True)
time.sleep(1)
wait_for_all_checks(client)
client.get(url_for("form_watch_checknow"), follow_redirects=True)
time.sleep(1)
wait_for_all_checks(client)
assert os.path.exists("test-datastore/notification.txt") == False
res = client.get(url_for("notification_logs"))
@@ -209,7 +210,7 @@ def test_check_notification(client, live_server):
url_for("edit_page", uuid="first"),
data={
"url": test_url,
"tag": "my tag",
"tags": "my tag",
"title": "my title",
"notification_urls": '',
"notification_title": '',
@@ -243,7 +244,7 @@ def test_notification_validation(client, live_server):
test_url = url_for('test_endpoint', _external=True)
res = client.post(
url_for("form_quick_watch_add"),
data={"url": test_url, "tag": 'nice one'},
data={"url": test_url, "tags": 'nice one'},
follow_redirects=True
)
@@ -303,13 +304,13 @@ def test_notification_custom_endpoint_and_jinja2(client, live_server):
test_url = url_for('test_endpoint', _external=True)
res = client.post(
url_for("form_quick_watch_add"),
data={"url": test_url, "tag": 'nice one'},
data={"url": test_url, "tags": 'nice one'},
follow_redirects=True
)
assert b"Watch added" in res.data
time.sleep(2)
wait_for_all_checks(client)
set_modified_response()
client.get(url_for("form_watch_checknow"), follow_redirects=True)