diff --git a/changedetectionio/tests/test_notification.py b/changedetectionio/tests/test_notification.py index 1d4a19847..c7767b9e2 100644 --- a/changedetectionio/tests/test_notification.py +++ b/changedetectionio/tests/test_notification.py @@ -5,8 +5,7 @@ import re from flask import url_for from loguru import logger -from .util import set_original_response, set_modified_response, set_more_modified_response, live_server_setup, wait_for_all_checks, \ - set_longer_modified_response, get_index +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 @@ -331,7 +330,7 @@ def test_notification_custom_endpoint_and_jinja2(client, live_server, measure_me # Check no errors were recorded, because we asked for 204 which is slightly uncommon but is still OK - res = get_index(client) + res = client.get(url_for("watchlist.index")) assert b'notification-error' not in res.data with open("test-datastore/notification.txt", 'r') as f: diff --git a/changedetectionio/tests/util.py b/changedetectionio/tests/util.py index 0048a13fc..9e4494292 100644 --- a/changedetectionio/tests/util.py +++ b/changedetectionio/tests/util.py @@ -325,20 +325,3 @@ def live_server_setup(live_server): live_server.start() - - -def get_index(client): - import inspect - # Get the caller's frame (parent function) - frame = inspect.currentframe() - caller_frame = frame.f_back # Go back to the caller's frame - caller_name = caller_frame.f_code.co_name - caller_line = caller_frame.f_lineno - - print(f"Called by: {caller_name}, Line: {caller_line}") - - res = client.get(url_for("watchlist.index")) - with open(f"test-datastore/index-{caller_name}-{caller_line}.html", 'wb') as f: - f.write(res.data) - - return res diff --git a/changedetectionio/tests/visualselector/test_fetch_data.py b/changedetectionio/tests/visualselector/test_fetch_data.py index e1c76b798..3f983a987 100644 --- a/changedetectionio/tests/visualselector/test_fetch_data.py +++ b/changedetectionio/tests/visualselector/test_fetch_data.py @@ -2,7 +2,7 @@ import os from flask import url_for -from ..util import live_server_setup, wait_for_all_checks, get_index +from ..util import live_server_setup, wait_for_all_checks def test_setup(client, live_server): live_server_setup(live_server) @@ -10,8 +10,6 @@ def test_setup(client, live_server): # Add a site in paused mode, add an invalid filter, we should still have visual selector data ready def test_visual_selector_content_ready(client, live_server, measure_memory_usage): - live_server.stop() - live_server.start() import os import json @@ -89,9 +87,6 @@ def test_visual_selector_content_ready(client, live_server, measure_memory_usage def test_basic_browserstep(client, live_server, measure_memory_usage): - live_server.stop() - live_server.start() - assert os.getenv('PLAYWRIGHT_DRIVER_URL'), "Needs PLAYWRIGHT_DRIVER_URL set for this test" test_url = url_for('test_interactive_html_endpoint', _external=True) @@ -144,12 +139,9 @@ def test_basic_browserstep(client, live_server, measure_memory_usage): assert b"testheader: yes" in res.data assert b"user-agent: mycustomagent" in res.data - live_server.stop() def test_non_200_errors_report_browsersteps(client, live_server): - live_server.stop() - live_server.start() four_o_four_url = url_for('test_endpoint', status_code=404, _external=True) four_o_four_url = four_o_four_url.replace('localhost.localdomain', 'cdio') @@ -183,7 +175,7 @@ def test_non_200_errors_report_browsersteps(client, live_server): wait_for_all_checks(client) - res = get_index(client) + res = client.get(url_for("watchlist.index")) assert b'Error - 404' in res.data