|
|
@ -3,7 +3,7 @@
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
from flask import url_for
|
|
|
|
from flask import url_for
|
|
|
|
from urllib.request import urlopen
|
|
|
|
from urllib.request import urlopen
|
|
|
|
from .util import set_original_response, set_modified_response, live_server_setup
|
|
|
|
from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks
|
|
|
|
|
|
|
|
|
|
|
|
sleep_time_for_fetch_thread = 3
|
|
|
|
sleep_time_for_fetch_thread = 3
|
|
|
|
|
|
|
|
|
|
|
@ -36,7 +36,7 @@ def test_check_basic_change_detection_functionality(client, live_server):
|
|
|
|
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
|
|
|
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
|
|
|
|
|
|
|
|
|
|
|
# Give the thread time to pick it up
|
|
|
|
# Give the thread time to pick it up
|
|
|
|
time.sleep(sleep_time_for_fetch_thread)
|
|
|
|
wait_for_all_checks(client)
|
|
|
|
|
|
|
|
|
|
|
|
# It should report nothing found (no new 'unviewed' class)
|
|
|
|
# It should report nothing found (no new 'unviewed' class)
|
|
|
|
res = client.get(url_for("index"))
|
|
|
|
res = client.get(url_for("index"))
|
|
|
@ -69,7 +69,7 @@ def test_check_basic_change_detection_functionality(client, live_server):
|
|
|
|
res = client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
|
|
|
res = client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
|
|
|
assert b'1 watches are queued for rechecking.' in res.data
|
|
|
|
assert b'1 watches are queued for rechecking.' in res.data
|
|
|
|
|
|
|
|
|
|
|
|
time.sleep(sleep_time_for_fetch_thread)
|
|
|
|
wait_for_all_checks(client)
|
|
|
|
|
|
|
|
|
|
|
|
# Now something should be ready, indicated by having a 'unviewed' class
|
|
|
|
# Now something should be ready, indicated by having a 'unviewed' class
|
|
|
|
res = client.get(url_for("index"))
|
|
|
|
res = client.get(url_for("index"))
|
|
|
@ -98,14 +98,14 @@ def test_check_basic_change_detection_functionality(client, live_server):
|
|
|
|
assert b'which has this one new line' in res.data
|
|
|
|
assert b'which has this one new line' in res.data
|
|
|
|
assert b'Which is across multiple lines' not in res.data
|
|
|
|
assert b'Which is across multiple lines' not in res.data
|
|
|
|
|
|
|
|
|
|
|
|
time.sleep(2)
|
|
|
|
wait_for_all_checks(client)
|
|
|
|
|
|
|
|
|
|
|
|
# Do this a few times.. ensures we dont accidently set the status
|
|
|
|
# Do this a few times.. ensures we dont accidently set the status
|
|
|
|
for n in range(2):
|
|
|
|
for n in range(2):
|
|
|
|
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
|
|
|
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
|
|
|
|
|
|
|
|
|
|
|
# Give the thread time to pick it up
|
|
|
|
# Give the thread time to pick it up
|
|
|
|
time.sleep(sleep_time_for_fetch_thread)
|
|
|
|
wait_for_all_checks(client)
|
|
|
|
|
|
|
|
|
|
|
|
# It should report nothing found (no new 'unviewed' class)
|
|
|
|
# It should report nothing found (no new 'unviewed' class)
|
|
|
|
res = client.get(url_for("index"))
|
|
|
|
res = client.get(url_for("index"))
|
|
|
@ -125,7 +125,7 @@ def test_check_basic_change_detection_functionality(client, live_server):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
|
|
|
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
|
|
|
time.sleep(sleep_time_for_fetch_thread)
|
|
|
|
wait_for_all_checks(client)
|
|
|
|
|
|
|
|
|
|
|
|
res = client.get(url_for("index"))
|
|
|
|
res = client.get(url_for("index"))
|
|
|
|
assert b'unviewed' in res.data
|
|
|
|
assert b'unviewed' in res.data
|
|
|
|