diff --git a/changedetectionio/tests/fetchers/test_custom_js_before_content.py b/changedetectionio/tests/fetchers/test_custom_js_before_content.py index 24d715b345d..d92694a0055 100644 --- a/changedetectionio/tests/fetchers/test_custom_js_before_content.py +++ b/changedetectionio/tests/fetchers/test_custom_js_before_content.py @@ -34,7 +34,7 @@ def test_execute_custom_js(client, live_server, measure_memory_usage): assert b"unpaused" in res.data wait_for_all_checks(client) - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) assert live_server.app.config['DATASTORE'].data['watching'][uuid].history_n >= 1, "Watch history had atleast 1 (everything fetched OK)" assert b"This text should be removed" not in res.data diff --git a/changedetectionio/tests/proxy_list/test_noproxy.py b/changedetectionio/tests/proxy_list/test_noproxy.py index 976fce4fcc3..f3d0e3003ea 100644 --- a/changedetectionio/tests/proxy_list/test_noproxy.py +++ b/changedetectionio/tests/proxy_list/test_noproxy.py @@ -48,7 +48,7 @@ def test_noproxy_option(client, live_server, measure_memory_usage): follow_redirects=True ) assert b"Watch added in Paused state, saving will unpause" in res.data - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) res = client.get( url_for("edit_page", uuid=uuid, unpause_on_save=1)) assert b'No proxy' in res.data diff --git a/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py b/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py index b81a79fcef8..56e45f187bb 100644 --- a/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py +++ b/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py @@ -81,7 +81,7 @@ def test_socks5(client, live_server, measure_memory_usage): assert "Awesome, you made it".encode('utf-8') in res.data # PROXY CHECKER WIDGET CHECK - this needs more checking - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) res = client.get( url_for("check_proxies.start_check", uuid=uuid), diff --git a/changedetectionio/tests/test_automatic_follow_ldjson_price.py b/changedetectionio/tests/test_automatic_follow_ldjson_price.py index e09661e3438..46abb2e4f46 100644 --- a/changedetectionio/tests/test_automatic_follow_ldjson_price.py +++ b/changedetectionio/tests/test_automatic_follow_ldjson_price.py @@ -99,7 +99,7 @@ def test_check_ldjson_price_autodetect(client, live_server, measure_memory_usage assert b'ldjson-price-track-offer' in res.data # Accept it - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) #time.sleep(1) client.get(url_for('price_data_follower.accept', uuid=uuid, follow_redirects=True)) client.get(url_for("form_watch_checknow"), follow_redirects=True) diff --git a/changedetectionio/tests/test_backend.py b/changedetectionio/tests/test_backend.py index 69100ff744c..f31f19e0483 100644 --- a/changedetectionio/tests/test_backend.py +++ b/changedetectionio/tests/test_backend.py @@ -68,7 +68,7 @@ def test_check_basic_change_detection_functionality(client, live_server, measure wait_for_all_checks(client) - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) # Check the 'get latest snapshot works' res = client.get(url_for("watch_get_latest_html", uuid=uuid)) diff --git a/changedetectionio/tests/test_encoding.py b/changedetectionio/tests/test_encoding.py index 6d0aa1ca245..416373644b8 100644 --- a/changedetectionio/tests/test_encoding.py +++ b/changedetectionio/tests/test_encoding.py @@ -40,7 +40,7 @@ def test_check_encoding_detection(client, live_server, measure_memory_usage): # Content type recording worked - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) assert live_server.app.config['DATASTORE'].data['watching'][uuid]['content-type'] == "text/html" res = client.get( diff --git a/changedetectionio/tests/test_filter_failure_notification.py b/changedetectionio/tests/test_filter_failure_notification.py index 46431e5d4b8..0b0304e2752 100644 --- a/changedetectionio/tests/test_filter_failure_notification.py +++ b/changedetectionio/tests/test_filter_failure_notification.py @@ -51,7 +51,7 @@ def run_filter_test(client, live_server, content_filter): assert b"1 Imported" in res.data wait_for_all_checks(client) - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) assert live_server.app.config['DATASTORE'].data['watching'][uuid]['consecutive_filter_failures'] == 0, "No filter = No filter failure" diff --git a/changedetectionio/tests/test_group.py b/changedetectionio/tests/test_group.py index 82f994fcb7e..f9881c4d369 100644 --- a/changedetectionio/tests/test_group.py +++ b/changedetectionio/tests/test_group.py @@ -288,7 +288,7 @@ def test_clone_tag_on_import(client, live_server, measure_memory_usage): assert b'test-tag' in res.data assert b'another-tag' in res.data - watch_uuid = extract_UUID_from_client(client) + watch_uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) res = client.get(url_for("form_clone", uuid=watch_uuid), follow_redirects=True) assert b'Cloned' in res.data @@ -315,7 +315,7 @@ def test_clone_tag_on_quickwatchform_add(client, live_server, measure_memory_usa assert b'test-tag' in res.data assert b'another-tag' in res.data - watch_uuid = extract_UUID_from_client(client) + watch_uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) res = client.get(url_for("form_clone", uuid=watch_uuid), follow_redirects=True) assert b'Cloned' in res.data diff --git a/changedetectionio/tests/test_ignore.py b/changedetectionio/tests/test_ignore.py index c710d7d4092..c7d0461cf1c 100644 --- a/changedetectionio/tests/test_ignore.py +++ b/changedetectionio/tests/test_ignore.py @@ -36,7 +36,7 @@ def test_ignore(client, live_server, measure_memory_usage): # Give the thread time to pick it up wait_for_all_checks(client) - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) # use the highlighter endpoint res = client.post( url_for("highlight_submit_ignore_url", uuid=uuid), diff --git a/changedetectionio/tests/test_live_preview.py b/changedetectionio/tests/test_live_preview.py index dd6c3d9594f..3a4ab989e99 100644 --- a/changedetectionio/tests/test_live_preview.py +++ b/changedetectionio/tests/test_live_preview.py @@ -29,7 +29,7 @@ def test_content_filter_live_preview(client, live_server, measure_memory_usage): data={"url": test_url, "tags": ''}, follow_redirects=True ) - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) res = client.post( url_for("edit_page", uuid=uuid), data={ diff --git a/changedetectionio/tests/test_notification.py b/changedetectionio/tests/test_notification.py index ceae292ed7d..a87e1b7e224 100644 --- a/changedetectionio/tests/test_notification.py +++ b/changedetectionio/tests/test_notification.py @@ -6,7 +6,7 @@ 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 + set_longer_modified_response, get_index from . util import extract_UUID_from_client import logging import base64 @@ -76,7 +76,7 @@ def test_check_notification(client, live_server, measure_memory_usage): testimage_png = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=' - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) datastore = 'test-datastore' with open(os.path.join(datastore, str(uuid), 'last-screenshot.png'), 'wb') as f: f.write(base64.b64decode(testimage_png)) @@ -328,7 +328,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 = client.get(url_for("index")) + res = get_index(client) assert b'notification-error' not in res.data with open("test-datastore/notification.txt", 'r') as f: diff --git a/changedetectionio/tests/test_request.py b/changedetectionio/tests/test_request.py index 88816308f8e..be174a0f574 100644 --- a/changedetectionio/tests/test_request.py +++ b/changedetectionio/tests/test_request.py @@ -378,7 +378,8 @@ def test_headers_textfile_in_request(client, live_server, measure_memory_usage): with open('test-datastore/headers.txt', 'w') as f: f.write("global-header: nice\r\nnext-global-header: nice\r\nurl-header-global: http://example.com/global") - with open('test-datastore/' + extract_UUID_from_client(client) + '/headers.txt', 'w') as f: + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) + with open(f'test-datastore/{uuid}/headers.txt', 'w') as f: f.write("watch-header: nice\r\nurl-header-watch: http://example.com/watch") wait_for_all_checks(client) diff --git a/changedetectionio/tests/test_restock_itemprop.py b/changedetectionio/tests/test_restock_itemprop.py index 4a908712186..e8ed2886a3c 100644 --- a/changedetectionio/tests/test_restock_itemprop.py +++ b/changedetectionio/tests/test_restock_itemprop.py @@ -380,7 +380,7 @@ def test_change_with_notification_values(client, live_server): ## Now test the "SEND TEST NOTIFICATION" is working os.unlink("test-datastore/notification.txt") - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) res = client.post(url_for("ajax_callback_send_notification_test", watch_uuid=uuid), data={}, follow_redirects=True) time.sleep(5) assert os.path.isfile("test-datastore/notification.txt"), "Notification received" diff --git a/changedetectionio/tests/test_rss.py b/changedetectionio/tests/test_rss.py index e249e0ada5b..2f2896ec56b 100644 --- a/changedetectionio/tests/test_rss.py +++ b/changedetectionio/tests/test_rss.py @@ -132,7 +132,7 @@ def test_rss_xpath_filtering(client, live_server, measure_memory_usage): ) assert b"Watch added in Paused state, saving will unpause" in res.data - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) res = client.post( url_for("edit_page", uuid=uuid, unpause_on_save=1), data={ diff --git a/changedetectionio/tests/test_scheduler.py b/changedetectionio/tests/test_scheduler.py index ccc1374d523..b7978d3d490 100644 --- a/changedetectionio/tests/test_scheduler.py +++ b/changedetectionio/tests/test_scheduler.py @@ -39,7 +39,7 @@ def test_check_basic_scheduler_functionality(client, live_server, measure_memory assert b"1 Imported" in res.data wait_for_all_checks(client) - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) # Setup all the days of the weeks using XXX as the placeholder for monday/tuesday/etc @@ -104,7 +104,7 @@ def test_check_basic_global_scheduler_functionality(client, live_server, measure assert b"1 Imported" in res.data wait_for_all_checks(client) - uuid = extract_UUID_from_client(client) + uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) # Setup all the days of the weeks using XXX as the placeholder for monday/tuesday/etc diff --git a/changedetectionio/tests/util.py b/changedetectionio/tests/util.py index 250f6742eb5..e90b6aa8af5 100644 --- a/changedetectionio/tests/util.py +++ b/changedetectionio/tests/util.py @@ -285,15 +285,43 @@ def test_interactive_html_endpoint():
This text should be removed