|
|
@ -5,7 +5,7 @@ import time
|
|
|
|
from flask import url_for
|
|
|
|
from flask import url_for
|
|
|
|
|
|
|
|
|
|
|
|
from ..html_tools import *
|
|
|
|
from ..html_tools import *
|
|
|
|
from .util import live_server_setup
|
|
|
|
from .util import live_server_setup, wait_for_all_checks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_setup(live_server):
|
|
|
|
def test_setup(live_server):
|
|
|
@ -119,12 +119,10 @@ across multiple lines
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_element_removal_full(client, live_server, measure_memory_usage):
|
|
|
|
def test_element_removal_full(client, live_server, measure_memory_usage):
|
|
|
|
sleep_time_for_fetch_thread = 3
|
|
|
|
#live_server_setup(live_server)
|
|
|
|
|
|
|
|
|
|
|
|
set_original_response()
|
|
|
|
set_original_response()
|
|
|
|
|
|
|
|
|
|
|
|
# Give the endpoint time to spin up
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add our URL to the import page
|
|
|
|
# Add our URL to the import page
|
|
|
|
test_url = url_for("test_endpoint", _external=True)
|
|
|
|
test_url = url_for("test_endpoint", _external=True)
|
|
|
@ -132,7 +130,8 @@ def test_element_removal_full(client, live_server, measure_memory_usage):
|
|
|
|
url_for("import_page"), data={"urls": test_url}, follow_redirects=True
|
|
|
|
url_for("import_page"), data={"urls": test_url}, follow_redirects=True
|
|
|
|
)
|
|
|
|
)
|
|
|
|
assert b"1 Imported" in res.data
|
|
|
|
assert b"1 Imported" in res.data
|
|
|
|
time.sleep(1)
|
|
|
|
wait_for_all_checks(client)
|
|
|
|
|
|
|
|
|
|
|
|
# Goto the edit page, add the filter data
|
|
|
|
# Goto the edit page, add the filter data
|
|
|
|
# Not sure why \r needs to be added - absent of the #changetext this is not necessary
|
|
|
|
# Not sure why \r needs to be added - absent of the #changetext this is not necessary
|
|
|
|
subtractive_selectors_data = "header\r\nfooter\r\nnav\r\n#changetext"
|
|
|
|
subtractive_selectors_data = "header\r\nfooter\r\nnav\r\n#changetext"
|
|
|
@ -148,6 +147,7 @@ def test_element_removal_full(client, live_server, measure_memory_usage):
|
|
|
|
follow_redirects=True,
|
|
|
|
follow_redirects=True,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
assert b"Updated watch." in res.data
|
|
|
|
assert b"Updated watch." in res.data
|
|
|
|
|
|
|
|
wait_for_all_checks(client)
|
|
|
|
|
|
|
|
|
|
|
|
# Check it saved
|
|
|
|
# Check it saved
|
|
|
|
res = client.get(
|
|
|
|
res = client.get(
|
|
|
@ -156,10 +156,10 @@ def test_element_removal_full(client, live_server, measure_memory_usage):
|
|
|
|
assert bytes(subtractive_selectors_data.encode("utf-8")) in res.data
|
|
|
|
assert bytes(subtractive_selectors_data.encode("utf-8")) in res.data
|
|
|
|
|
|
|
|
|
|
|
|
# Trigger a check
|
|
|
|
# Trigger a check
|
|
|
|
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 queued for rechecking.' in res.data
|
|
|
|
|
|
|
|
|
|
|
|
# Give the thread time to pick it up
|
|
|
|
wait_for_all_checks(client)
|
|
|
|
time.sleep(sleep_time_for_fetch_thread)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# so that we set the state to 'unviewed' after all the edits
|
|
|
|
# so that we set the state to 'unviewed' after all the edits
|
|
|
|
client.get(url_for("diff_history_page", uuid="first"))
|
|
|
|
client.get(url_for("diff_history_page", uuid="first"))
|
|
|
@ -168,10 +168,11 @@ def test_element_removal_full(client, live_server, measure_memory_usage):
|
|
|
|
set_modified_response()
|
|
|
|
set_modified_response()
|
|
|
|
|
|
|
|
|
|
|
|
# Trigger a check
|
|
|
|
# Trigger a check
|
|
|
|
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 queued for rechecking.' in res.data
|
|
|
|
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
|
|
|
|
# There should not be an unviewed change, as changes should be removed
|
|
|
|
# There should not be an unviewed change, as changes should be removed
|
|
|
|
res = client.get(url_for("index"))
|
|
|
|
res = client.get(url_for("index"))
|
|
|
|