mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-06 01:26:25 +00:00
Compare commits
4 Commits
plugin-arc
...
no-change-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d93f0e135 | ||
|
|
debee13a33 | ||
|
|
592e1b37c0 | ||
|
|
3a9ed7f69e |
@@ -677,6 +677,7 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
datastore.needs_write_urgent = True
|
datastore.needs_write_urgent = True
|
||||||
|
|
||||||
# Queue the watch for immediate recheck, with a higher priority
|
# Queue the watch for immediate recheck, with a higher priority
|
||||||
|
# 'False' - fully reprocess the diff so we can see any new filters added
|
||||||
update_q.put(queuedWatchMetaData.PrioritizedItem(priority=1, item={'uuid': uuid, 'skip_when_checksum_same': False}))
|
update_q.put(queuedWatchMetaData.PrioritizedItem(priority=1, item={'uuid': uuid, 'skip_when_checksum_same': False}))
|
||||||
|
|
||||||
# Diff page [edit] link should go back to diff page
|
# Diff page [edit] link should go back to diff page
|
||||||
@@ -1254,6 +1255,9 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
@app.route("/api/checknow", methods=['GET'])
|
@app.route("/api/checknow", methods=['GET'])
|
||||||
@login_optionally_required
|
@login_optionally_required
|
||||||
def form_watch_checknow():
|
def form_watch_checknow():
|
||||||
|
|
||||||
|
# 'skip_when_checksum_same': should be False so that 'FilterNotFoundInResponse' can be checked
|
||||||
|
|
||||||
# Forced recheck will skip the 'skip if content is the same' rule (, 'reprocess_existing_data': True})))
|
# Forced recheck will skip the 'skip if content is the same' rule (, 'reprocess_existing_data': True})))
|
||||||
tag = request.args.get('tag')
|
tag = request.args.get('tag')
|
||||||
uuid = request.args.get('uuid')
|
uuid = request.args.get('uuid')
|
||||||
|
|||||||
@@ -306,8 +306,8 @@ class perform_site_check(difference_detection_processor):
|
|||||||
if not rendered_diff and stripped_text_from_html:
|
if not rendered_diff and stripped_text_from_html:
|
||||||
# We had some content, but no differences were found
|
# We had some content, but no differences were found
|
||||||
# Store our new file as the MD5 so it will trigger in the future
|
# Store our new file as the MD5 so it will trigger in the future
|
||||||
c = hashlib.md5(text_content_before_ignored_filter.translate(None, b'\r\n\t ')).hexdigest()
|
update_obj['previous_md5'] = hashlib.md5(text_content_before_ignored_filter.translate(None, b'\r\n\t ')).hexdigest()
|
||||||
return False, {'previous_md5': c}, stripped_text_from_html.encode('utf-8')
|
return False, update_obj, stripped_text_from_html.encode('utf-8')
|
||||||
else:
|
else:
|
||||||
stripped_text_from_html = rendered_diff
|
stripped_text_from_html = rendered_diff
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ def set_original(excluding=None, add_line=None):
|
|||||||
for i in test_return_data.splitlines():
|
for i in test_return_data.splitlines():
|
||||||
if not excluding in i:
|
if not excluding in i:
|
||||||
output += f"{i}\n"
|
output += f"{i}\n"
|
||||||
|
|
||||||
test_return_data = output
|
test_return_data = output
|
||||||
|
|
||||||
with open("test-datastore/endpoint-content.txt", "w") as f:
|
with open("test-datastore/endpoint-content.txt", "w") as f:
|
||||||
@@ -39,9 +38,8 @@ def test_setup(client, live_server):
|
|||||||
live_server_setup(live_server)
|
live_server_setup(live_server)
|
||||||
|
|
||||||
def test_check_removed_line_contains_trigger(client, live_server):
|
def test_check_removed_line_contains_trigger(client, live_server):
|
||||||
|
#live_server_setup(live_server)
|
||||||
# Give the endpoint time to spin up
|
# Give the endpoint time to spin up
|
||||||
time.sleep(1)
|
|
||||||
set_original()
|
set_original()
|
||||||
# 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)
|
||||||
@@ -52,9 +50,14 @@ def test_check_removed_line_contains_trigger(client, live_server):
|
|||||||
)
|
)
|
||||||
assert b"1 Imported" in res.data
|
assert b"1 Imported" in res.data
|
||||||
|
|
||||||
|
from .util import extract_UUID_from_client
|
||||||
|
uuid = extract_UUID_from_client(client)
|
||||||
|
|
||||||
# Give the thread time to pick it up
|
# Give the thread time to pick it up
|
||||||
wait_for_all_checks(client)
|
wait_for_all_checks(client)
|
||||||
|
|
||||||
|
#assert live_server.app.config['DATASTORE'].data['watching'][uuid]['previous_md5_before_filters'] == '3f10f9d7e3bc2b04197f525b30ca05af'
|
||||||
|
|
||||||
# Goto the edit page, add our ignore text
|
# Goto the edit page, add our ignore text
|
||||||
# Add our URL to the import page
|
# Add our URL to the import page
|
||||||
res = client.post(
|
res = client.post(
|
||||||
@@ -67,12 +70,13 @@ def test_check_removed_line_contains_trigger(client, live_server):
|
|||||||
)
|
)
|
||||||
assert b"Updated watch." in res.data
|
assert b"Updated watch." in res.data
|
||||||
wait_for_all_checks(client)
|
wait_for_all_checks(client)
|
||||||
set_original(excluding='Something irrelevant')
|
|
||||||
|
|
||||||
|
set_original(excluding='Something irrelevant')
|
||||||
# A line thats not the trigger should not trigger anything
|
# A line thats not the trigger should not trigger anything
|
||||||
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 queued for rechecking.' in res.data
|
assert b'1 watches queued for rechecking.' in res.data
|
||||||
wait_for_all_checks(client)
|
wait_for_all_checks(client)
|
||||||
|
assert live_server.app.config['DATASTORE'].data['watching'][uuid]['previous_md5_before_filters'] == '1262fa651e226e126fabe0275e131e82'
|
||||||
res = client.get(url_for("index"))
|
res = client.get(url_for("index"))
|
||||||
assert b'unviewed' not in res.data
|
assert b'unviewed' not in res.data
|
||||||
|
|
||||||
@@ -92,10 +96,14 @@ def test_check_removed_line_contains_trigger(client, live_server):
|
|||||||
res = client.get(url_for("index"))
|
res = client.get(url_for("index"))
|
||||||
assert b'unviewed' not in res.data
|
assert b'unviewed' not in res.data
|
||||||
|
|
||||||
# Remove it again, and we should get a trigger
|
# It should now have 'The golden line' back, so we remove it, check again
|
||||||
|
# We should get a trigger
|
||||||
set_original(excluding='The golden line')
|
set_original(excluding='The golden line')
|
||||||
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
client.get(url_for("form_watch_checknow"), follow_redirects=True)
|
||||||
wait_for_all_checks(client)
|
wait_for_all_checks(client)
|
||||||
|
#assert live_server.app.config['DATASTORE'].data['watching'][uuid]['previous_md5_before_filters'] == '2288c23519a6a90809defb37d79f98f4'
|
||||||
|
res = client.get(url_for("preview_page", uuid="first"))
|
||||||
|
assert b'The golden line' not in res.data
|
||||||
res = client.get(url_for("index"))
|
res = client.get(url_for("index"))
|
||||||
assert b'unviewed' in res.data
|
assert b'unviewed' in res.data
|
||||||
|
|
||||||
@@ -107,7 +115,7 @@ def test_check_add_line_contains_trigger(client, live_server):
|
|||||||
#live_server_setup(live_server)
|
#live_server_setup(live_server)
|
||||||
|
|
||||||
# Give the endpoint time to spin up
|
# Give the endpoint time to spin up
|
||||||
time.sleep(1)
|
#time.sleep(1)
|
||||||
test_notification_url = url_for('test_notification_endpoint', _external=True).replace('http://', 'post://') + "?xxx={{ watch_url }}"
|
test_notification_url = url_for('test_notification_endpoint', _external=True).replace('http://', 'post://') + "?xxx={{ watch_url }}"
|
||||||
|
|
||||||
res = client.post(
|
res = client.post(
|
||||||
|
|||||||
@@ -427,7 +427,6 @@ class update_worker(threading.Thread):
|
|||||||
if update_handler.xpath_data:
|
if update_handler.xpath_data:
|
||||||
self.datastore.save_xpath_data(watch_uuid=uuid, data=update_handler.xpath_data)
|
self.datastore.save_xpath_data(watch_uuid=uuid, data=update_handler.xpath_data)
|
||||||
|
|
||||||
|
|
||||||
self.current_uuid = None # Done
|
self.current_uuid = None # Done
|
||||||
self.q.task_done()
|
self.q.task_done()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user