From b069c2d04a0e6adc2b19a50cefef6bf57cb98de4 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 26 Jul 2022 17:00:15 +0200 Subject: [PATCH] Tweak tests --- changedetectionio/tests/test_extract_regex.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/changedetectionio/tests/test_extract_regex.py b/changedetectionio/tests/test_extract_regex.py index 6a944ca1..7d958c5e 100644 --- a/changedetectionio/tests/test_extract_regex.py +++ b/changedetectionio/tests/test_extract_regex.py @@ -15,7 +15,7 @@ def set_original_response():
So let's see what happens.
Some text thats the same
-
Some text that will change
+
Some text that will change
""" @@ -33,7 +33,8 @@ def set_modified_response():
So let's see what happens.
Some text thats the same
-
Some text that did change ( 1000 online
80 guests
2000 online )
+
Some text that did change ( 1000 online
80 guests
2000 online )
+
SomeCase insensitive 3456
""" @@ -48,7 +49,7 @@ def test_check_filter_and_regex_extract(client, live_server): sleep_time_for_fetch_thread = 3 live_server_setup(live_server) - css_filter = "#changetext" + css_filter = ".changetext" set_original_response() @@ -76,7 +77,7 @@ def test_check_filter_and_regex_extract(client, live_server): res = client.post( url_for("edit_page", uuid="first"), data={"css_filter": css_filter, - 'extract_text': '\d+ online\n\d+ guests', + 'extract_text': '\d+ online\r\n\d+ guests\r\n/somecase insensitive \d+/i\r\n', "url": test_url, "tag": "", "headers": "", @@ -87,16 +88,10 @@ def test_check_filter_and_regex_extract(client, live_server): assert b"Updated watch." in res.data - time.sleep(2) - # Check it saved res = client.get( url_for("edit_page", uuid="first"), ) - assert b'\d+ online' in res.data - - # Trigger a check -# client.get(url_for("form_watch_checknow"), follow_redirects=True) # Give the thread time to pick it up time.sleep(sleep_time_for_fetch_thread) @@ -129,5 +124,11 @@ def test_check_filter_and_regex_extract(client, live_server): # Both regexs should be here assert b'
80 guests' in res.data + # Regex with flag handling should be here + + assert b'
SomeCase insensitive 3456' in res.data + + # Regex with multiline flag handling should be here + # Should not be here assert b'Some text that did change' not in res.data