Shuffling endpoint

This commit is contained in:
dgtlmoon committed 2025-12-12 15:13:24 +01:00
1 parent c1a88cb9ca
commit cd45492ebb
46 files changed
+103 -567

No files matched your search

+1 -1
View File
@@ -81,7 +81,7 @@ def construct_main_feed_routes(rss_blueprint, datastore):
timestamp_from = dates[-2]
guid = generate_watch_guid(watch, timestamp_to)
# Because we are called via whatever web server, flask should figure out the right path
diff_link = {'href': url_for('ui.ui_views.diff_history_page', uuid=watch['uuid'], _external=True)}
diff_link = {'href': url_for('ui.ui_diff.diff_history_page', uuid=watch['uuid'], _external=True)}
# Get template and build notification context
n_body_template = get_rss_template(datastore, watch, rss_content_format,
+1 -1
View File
@@ -67,7 +67,7 @@ def construct_tag_routes(rss_blueprint, datastore):
watch['uuid'] = uuid
# Include a link to the diff page
diff_link = {'href': url_for('ui.ui_views.diff_history_page', uuid=watch['uuid'], _external=True)}
diff_link = {'href': url_for('ui.ui_diff.diff_history_page', uuid=watch['uuid'], _external=True)}
# Get watch label
watch_label = get_watch_label(datastore, watch)
@@ -6,6 +6,7 @@ from changedetectionio.store import ChangeDetectionStore
from changedetectionio.blueprint.ui.edit import construct_blueprint as construct_edit_blueprint
from changedetectionio.blueprint.ui.notification import construct_blueprint as construct_notification_blueprint
from changedetectionio.blueprint.ui.views import construct_blueprint as construct_views_blueprint
from changedetectionio.blueprint.ui import diff, preview
def _handle_operations(op, uuids, datastore, worker_handler, update_q, queuedWatchMetaData, watch_check_update, extra_data=None, emit_flash=True):
from flask import request, flash
@@ -121,6 +122,13 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, worker_handle
views_blueprint = construct_views_blueprint(datastore, update_q, queuedWatchMetaData, watch_check_update)
ui_blueprint.register_blueprint(views_blueprint)
# Register diff and preview blueprints
diff_blueprint = diff.construct_blueprint(datastore)
ui_blueprint.register_blueprint(diff_blueprint)
preview_blueprint = preview.construct_blueprint(datastore)
ui_blueprint.register_blueprint(preview_blueprint)
# Import the login decorator
from changedetectionio.auth_decorator import login_optionally_required
+2 -2
View File
@@ -206,7 +206,7 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMe
# Diff page [edit] link should go back to diff page
if request.args.get("next") and request.args.get("next") == 'diff':
return redirect(url_for('ui.ui_views.diff_history_page', uuid=uuid))
return redirect(url_for('ui.ui_diff.diff_history_page', uuid=uuid))
return redirect(url_for('watchlist.index', tag=request.args.get("tag",'')))
@@ -340,6 +340,6 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMe
s = re.sub(r'[0-9]+', r'\\d+', s)
datastore.data["watching"][uuid]['ignore_text'].append('/' + s + '/')
return f"<a href={url_for('ui.ui_views.preview_page', uuid=uuid)}>Click to preview</a>"
return f"<a href={url_for('ui.ui_preview.preview_page', uuid=uuid)}>Click to preview</a>"
return edit_blueprint
@@ -21,7 +21,7 @@
<div id="settings">
<form class="pure-form " action="{{ url_for("ui.ui_views.diff_history_page", uuid=uuid) }}" method="GET" id="diff-form">
<form class="pure-form " action="{{ url_for("ui.ui_diff.diff_history_page", uuid=uuid) }}" method="GET" id="diff-form">
<fieldset class="diff-fieldset">
{% if versions|length >= 1 %}
<span style="white-space: nowrap;">
@@ -125,7 +125,7 @@
<div{% if cell.class %} class="{{ cell.class }}"{% endif %}></div>
{%- endfor -%}
</div>
<div class="snapshot-age">{{ from_version|format_timestamp_timeago }} {%- if note -%}<span class="note"><strong>{{ note }}</strong></span>{%- endif -%} <a href="{{ url_for("ui.ui_views.preview_page", uuid=uuid) }}">Goto single snapshot</a></div>
<div class="snapshot-age">{{ from_version|format_timestamp_timeago }} {%- if note -%}<span class="note"><strong>{{ note }}</strong></span>{%- endif -%} <a href="{{ url_for("ui.ui_preview.preview_page", uuid=uuid) }}">Goto single snapshot</a></div>
<pre id="difference" style="border-left: 2px solid #ddd;">{{ content| diff_unescape_difference_spans }}</pre>
</div>
@@ -146,7 +146,7 @@
</div>
<div class="tab-pane-inner" id="extract">
<form id="extract-data-form" class="pure-form pure-form-stacked edit-form"
action="{{ url_for('ui.ui_views.diff_history_page', uuid=uuid) }}#extract"
action="{{ url_for('ui.ui_diff.diff_history_page', uuid=uuid) }}#extract"
method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
+1 -473
View File
@@ -1,484 +1,12 @@
from flask import Blueprint, request, redirect, url_for, flash, render_template, make_response, send_from_directory, abort
import os
import time
import re
from loguru import logger
from markupsafe import Markup
from changedetectionio.diff import (
REMOVED_STYLE, ADDED_STYLE, REMOVED_INNER_STYLE, ADDED_INNER_STYLE,
REMOVED_PLACEMARKER_OPEN, REMOVED_PLACEMARKER_CLOSED,
ADDED_PLACEMARKER_OPEN, ADDED_PLACEMARKER_CLOSED,
CHANGED_PLACEMARKER_OPEN, CHANGED_PLACEMARKER_CLOSED,
CHANGED_INTO_PLACEMARKER_OPEN, CHANGED_INTO_PLACEMARKER_CLOSED
)
from changedetectionio.notification.handler import apply_html_color_to_body
from flask import Blueprint, request, redirect, url_for, flash
from changedetectionio.store import ChangeDetectionStore
from changedetectionio.auth_decorator import login_optionally_required
from changedetectionio import html_tools, diff, strtobool
from changedetectionio import worker_handler
def build_diff_cell_visualizer(content, resolution=100):
"""
Build a visual cell grid for the diff visualizer.
Analyzes the content for placemarkers indicating changes and creates a
grid of cells representing the document, with each cell marked as:
- 'deletion' for removed content
- 'insertion' for added content
- 'mixed' for cells containing both deletions and insertions
- empty string for cells with no changes
Args:
content: The diff content with placemarkers
resolution: Number of cells to create (default 100)
Returns:
List of dicts with 'class' key for each cell's CSS class
"""
if not content:
return [{'class': ''} for _ in range(resolution)]
now = time.time()
# Work with character positions for better accuracy
content_length = len(content)
if content_length == 0:
return [{'class': ''} for _ in range(resolution)]
chars_per_cell = max(1, content_length / resolution)
# Track change type for each cell
cell_data = {}
# Placemarkers to detect
change_markers = {
REMOVED_PLACEMARKER_OPEN: 'deletion',
ADDED_PLACEMARKER_OPEN: 'insertion',
CHANGED_PLACEMARKER_OPEN: 'deletion',
CHANGED_INTO_PLACEMARKER_OPEN: 'insertion',
}
# Find all occurrences of each marker
for marker, change_type in change_markers.items():
pos = 0
while True:
pos = content.find(marker, pos)
if pos == -1:
break
# Calculate which cell this marker falls into
cell_index = min(int(pos / chars_per_cell), resolution - 1)
if cell_index not in cell_data:
cell_data[cell_index] = change_type
elif cell_data[cell_index] != change_type:
# Mixed changes in this cell
cell_data[cell_index] = 'mixed'
pos += len(marker)
# Build the cell list
cells = []
for i in range(resolution):
change_type = cell_data.get(i, '')
cells.append({'class': change_type})
logger.debug(f"Built diff cell visualizer: {len([c for c in cells if c['class']])} cells with changes out of {resolution} in {time.time() - now:.2f}s")
return cells
def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMetaData, watch_check_update):
views_blueprint = Blueprint('ui_views', __name__, template_folder="../ui/templates")
# Diff display preferences configuration - single source of truth
DIFF_PREFERENCES_CONFIG = {
'changesOnly': {'default': True, 'type': 'bool'},
'ignoreWhitespace': {'default': False, 'type': 'bool'},
'removed': {'default': True, 'type': 'bool'},
'added': {'default': True, 'type': 'bool'},
'replaced': {'default': True, 'type': 'bool'},
'type': {'default': 'diffLines', 'type': 'value'},
}
@views_blueprint.app_template_filter('diff_unescape_difference_spans')
def diff_unescape_difference_spans(content):
"""Emulate Jinja2's auto-escape, then selectively unescape our diff spans."""
from markupsafe import escape
if not content:
return Markup('')
# Step 1: Escape everything like Jinja2 would (this makes it XSS-safe)
escaped_content = escape(str(content))
# Step 2: Unescape only our exact diff spans generated by apply_html_color_to_body()
# Pattern matches the exact structure:
# <span style="{STYLE}" role="{ROLE}" aria-label="{LABEL}" title="{TITLE}">
# Unescape outer span opening tags with full attributes (role, aria-label, title)
# Matches removed/added/changed/changed_into spans
result = re.sub(
rf'&lt;span style=&#34;({re.escape(REMOVED_STYLE)}|{re.escape(ADDED_STYLE)})&#34; '
rf'role=&#34;(deletion|insertion|note)&#34; '
rf'aria-label=&#34;([^&]+?)&#34; '
rf'title=&#34;([^&]+?)&#34;&gt;',
r'<span style="\1" role="\2" aria-label="\3" title="\4">',
str(escaped_content),
flags=re.IGNORECASE
)
# Unescape inner span opening tags (without additional attributes)
# This matches the darker background styles for changed parts within lines
result = re.sub(
rf'&lt;span style=&#34;({re.escape(REMOVED_INNER_STYLE)}|{re.escape(ADDED_INNER_STYLE)})&#34;&gt;',
r'<span style="\1">',
result,
flags=re.IGNORECASE
)
# Unescape closing tags (but only as many as we opened)
open_count = result.count('<span style=')
close_count = str(escaped_content).count('&lt;/span&gt;')
# Replace up to the number of spans we opened
for _ in range(min(open_count, close_count)):
result = result.replace('&lt;/span&gt;', '</span>', 1)
return Markup(result)
@views_blueprint.route("/preview/<string:uuid>", methods=['GET'])
@login_optionally_required
def preview_page(uuid):
content = []
versions = []
timestamp = None
# More for testing, possible to return the first/only
if uuid == 'first':
uuid = list(datastore.data['watching'].keys()).pop()
try:
watch = datastore.data['watching'][uuid]
except KeyError:
flash("No history found for the specified link, bad link?", "error")
return redirect(url_for('watchlist.index'))
system_uses_webdriver = datastore.data['settings']['application']['fetch_backend'] == 'html_webdriver'
extra_stylesheets = [url_for('static_content', group='styles', filename='diff.css')]
is_html_webdriver = False
if (watch.get('fetch_backend') == 'system' and system_uses_webdriver) or watch.get('fetch_backend') == 'html_webdriver' or watch.get('fetch_backend', '').startswith('extra_browser_'):
is_html_webdriver = True
triggered_line_numbers = []
ignored_line_numbers = []
blocked_line_numbers = []
if datastore.data['watching'][uuid].history_n == 0 and (watch.get_error_text() or watch.get_error_snapshot()):
flash("Preview unavailable - No fetch/check completed or triggers not reached", "error")
else:
# So prepare the latest preview or not
preferred_version = request.args.get('version')
versions = list(watch.history.keys())
timestamp = versions[-1]
if preferred_version and preferred_version in versions:
timestamp = preferred_version
try:
versions = list(watch.history.keys())
content = watch.get_history_snapshot(timestamp=timestamp)
triggered_line_numbers = html_tools.strip_ignore_text(content=content,
wordlist=watch.get('trigger_text'),
mode='line numbers'
)
ignored_line_numbers = html_tools.strip_ignore_text(content=content,
wordlist=watch.get('ignore_text'),
mode='line numbers'
)
blocked_line_numbers = html_tools.strip_ignore_text(content=content,
wordlist=watch.get("text_should_not_be_present"),
mode='line numbers'
)
except Exception as e:
content.append({'line': f"File doesnt exist or unable to read timestamp {timestamp}", 'classes': ''})
output = render_template("preview.html",
content=content,
current_diff_url=watch['url'],
current_version=timestamp,
extra_stylesheets=extra_stylesheets,
extra_title=f" - Diff - {watch.label} @ {timestamp}",
highlight_ignored_line_numbers=ignored_line_numbers,
highlight_triggered_line_numbers=triggered_line_numbers,
highlight_blocked_line_numbers=blocked_line_numbers,
history_n=watch.history_n,
is_html_webdriver=is_html_webdriver,
last_error=watch['last_error'],
last_error_screenshot=watch.get_error_snapshot(),
last_error_text=watch.get_error_text(),
screenshot=watch.get_screenshot(),
uuid=uuid,
versions=versions,
watch=watch,
)
return output
@views_blueprint.route("/diff/<string:uuid>", methods=['POST'])
@login_optionally_required
def diff_history_page_build_report(uuid):
import importlib
from changedetectionio import forms
# More for testing, possible to return the first/only
if uuid == 'first':
uuid = list(datastore.data['watching'].keys()).pop()
try:
watch = datastore.data['watching'][uuid]
except KeyError:
flash("No history found for the specified link, bad link?", "error")
return redirect(url_for('watchlist.index'))
# For submission of requesting an extract
extract_form = forms.extractDataForm(formdata=request.form,
data={'extract_regex': request.form.get('extract_regex', '')}
)
if not extract_form.validate():
flash("An error occurred, please see below.", "error")
# Use processor-specific render with the error form
processor_name = watch.get('processor', 'text_json_diff')
try:
processor_module = importlib.import_module(f'changedetectionio.processors.{processor_name}.difference')
if hasattr(processor_module, 'render'):
return processor_module.render(
watch=watch,
datastore=datastore,
request=request,
url_for=url_for,
render_template=render_template,
flash=flash,
redirect=redirect,
extract_form=extract_form
)
except (ImportError, ModuleNotFoundError):
pass
# Fallback to text_json_diff
from changedetectionio.processors.text_json_diff.difference import render as default_render
return default_render(
watch=watch,
datastore=datastore,
request=request,
url_for=url_for,
render_template=render_template,
flash=flash,
redirect=redirect,
extract_form=extract_form
)
else:
extract_regex = request.form.get('extract_regex', '').strip()
output = watch.extract_regex_from_all_history(extract_regex)
if output:
watch_dir = os.path.join(datastore.datastore_path, uuid)
response = make_response(send_from_directory(directory=watch_dir, path=output, as_attachment=True))
response.headers['Content-type'] = 'text/csv'
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
response.headers['Pragma'] = 'no-cache'
response.headers['Expires'] = "0"
return response
flash('No matches found while scanning all of the watch history for that RegEx.', 'error')
return redirect(url_for('ui.ui_views.diff_history_page', uuid=uuid) + '#extract')
def _render_diff_template(uuid, extract_form=None):
"""Helper function to render the diff template with all required data"""
from changedetectionio import forms
# More for testing, possible to return the first/only
if uuid == 'first':
uuid = list(datastore.data['watching'].keys()).pop()
extra_stylesheets = [url_for('static_content', group='styles', filename='diff.css')]
try:
watch = datastore.data['watching'][uuid]
except KeyError:
flash("No history found for the specified link, bad link?", "error")
return redirect(url_for('watchlist.index'))
# Use provided form or create a new one
if extract_form is None:
extract_form = forms.extractDataForm(formdata=request.form,
data={'extract_regex': request.form.get('extract_regex', '')}
)
history = watch.history
dates = list(history.keys())
# If a "from_version" was requested, then find it (or the closest one)
# Also set "from version" to be the closest version to the one that was last viewed.
best_last_viewed_timestamp = watch.get_from_version_based_on_last_viewed
from_version_timestamp = best_last_viewed_timestamp if best_last_viewed_timestamp else dates[-2]
from_version = request.args.get('from_version', from_version_timestamp )
# Use the current one if nothing was specified
to_version = request.args.get('to_version', str(dates[-1]))
try:
to_version_file_contents = watch.get_history_snapshot(timestamp=to_version)
except Exception as e:
logger.error(f"Unable to read watch history to-version for version {to_version}: {str(e)}")
to_version_file_contents = f"Unable to read to-version at {to_version}.\n"
try:
from_version_file_contents = watch.get_history_snapshot(timestamp=from_version)
except Exception as e:
logger.error(f"Unable to read watch history from-version for version {from_version}: {str(e)}")
from_version_file_contents = f"Unable to read to-version {from_version}.\n"
screenshot_url = watch.get_screenshot()
system_uses_webdriver = datastore.data['settings']['application']['fetch_backend'] == 'html_webdriver'
is_html_webdriver = False
if (watch.get('fetch_backend') == 'system' and system_uses_webdriver) or watch.get('fetch_backend') == 'html_webdriver' or watch.get('fetch_backend', '').startswith('extra_browser_'):
is_html_webdriver = True
password_enabled_and_share_is_off = False
if datastore.data['settings']['application'].get('password') or os.getenv("SALTED_PASS", False):
password_enabled_and_share_is_off = not datastore.data['settings']['application'].get('shared_diff_access')
datastore.set_last_viewed(uuid, time.time())
# Parse diff preferences from request using config as single source of truth
# Check if this is a user submission (any diff pref param exists in query string)
user_submitted = any(key in request.args for key in DIFF_PREFERENCES_CONFIG.keys())
diff_prefs = {}
for key, config in DIFF_PREFERENCES_CONFIG.items():
if user_submitted:
# User submitted form - missing checkboxes are explicitly OFF
if config['type'] == 'bool':
diff_prefs[key] = strtobool(request.args.get(key, 'off'))
else:
diff_prefs[key] = request.args.get(key, config['default'])
else:
# Initial load - use defaults from config
diff_prefs[key] = config['default']
content = diff.render_diff(previous_version_file_contents=from_version_file_contents,
newest_version_file_contents=to_version_file_contents,
include_replaced=diff_prefs['replaced'],
include_added=diff_prefs['added'],
include_removed=diff_prefs['removed'],
include_equal=diff_prefs['changesOnly'],
ignore_junk=diff_prefs['ignoreWhitespace'],
word_diff=diff_prefs['type'] == 'diffWords',
)
# Build cell grid visualizer before applying HTML color (so we can detect placemarkers)
diff_cell_grid = build_diff_cell_visualizer(content)
content = apply_html_color_to_body(n_body=content)
offscreen_content = render_template("diff-offscreen-options.html")
note = ''
if str(from_version) != str(dates[-2]) or str(to_version) != str(dates[-1]):
note = 'Note: You are not viewing the latest changes.'
output = render_template("diff.html",
#initial_scroll_line_number=100,
bottom_horizontal_offscreen_contents=offscreen_content,
content=content,
current_diff_url=watch['url'],
diff_cell_grid=diff_cell_grid,
diff_prefs=diff_prefs,
extra_classes='difference-page',
extra_stylesheets=extra_stylesheets,
extra_title=f" - {watch.label} - History",
extract_form=extract_form,
from_version=str(from_version),
is_html_webdriver=is_html_webdriver,
last_error=watch['last_error'],
last_error_screenshot=watch.get_error_snapshot(),
last_error_text=watch.get_error_text(),
newest=to_version_file_contents,
newest_version_timestamp=dates[-1],
note=note,
password_enabled_and_share_is_off=password_enabled_and_share_is_off,
pure_menu_fixed=False,
screenshot=screenshot_url,
to_version=str(to_version),
uuid=uuid,
versions=dates, # All except current/last
watch_a=watch,
)
return output
@views_blueprint.route("/diff/<string:uuid>", methods=['GET'])
@login_optionally_required
def diff_history_page(uuid):
"""
Render the history/diff page for a watch.
This route is processor-aware: it delegates rendering to the processor's
difference.py module, allowing different processor types to provide
custom visualizations:
- text_json_diff: Text/HTML diff with syntax highlighting
- restock_diff: Could show price charts and stock history
- image_diff: Could show image comparison slider/overlay
Each processor implements processors/{type}/difference.py::render()
If a processor doesn't have a difference module, falls back to text_json_diff.
"""
import importlib
# More for testing, possible to return the first/only
if uuid == 'first':
uuid = list(datastore.data['watching'].keys()).pop()
try:
watch = datastore.data['watching'][uuid]
except KeyError:
flash("No history found for the specified link, bad link?", "error")
return redirect(url_for('watchlist.index'))
# Get the processor type for this watch
processor_name = watch.get('processor', 'text_json_diff')
try:
# Try to import the processor's difference module
processor_module = importlib.import_module(f'changedetectionio.processors.{processor_name}.difference')
# Call the processor's render() function
if hasattr(processor_module, 'render'):
return processor_module.render(
watch=watch,
datastore=datastore,
request=request,
url_for=url_for,
render_template=render_template,
flash=flash,
redirect=redirect
)
except (ImportError, ModuleNotFoundError) as e:
logger.warning(f"Processor {processor_name} does not have a difference module, falling back to text_json_diff: {e}")
# Fallback: if processor doesn't have difference module, use text_json_diff as default
from changedetectionio.processors.text_json_diff.difference import render as default_render
return default_render(
watch=watch,
datastore=datastore,
request=request,
url_for=url_for,
render_template=render_template,
flash=flash,
redirect=redirect
)
@views_blueprint.route("/form/add/quickwatch", methods=['POST'])
@login_optionally_required
def form_quick_watch_add():
@@ -235,8 +235,8 @@ document.addEventListener('DOMContentLoaded', function() {
<a href="" class="already-in-queue-button recheck pure-button pure-button-primary" style="display: none;" disabled="disabled">Queued</a>
<a href="{{ url_for('ui.form_watch_checknow', uuid=watch.uuid, tag=request.args.get('tag')) }}" data-op='recheck' class="ajax-op recheck pure-button pure-button-primary">Recheck</a>
<a href="{{ url_for('ui.ui_edit.edit_page', uuid=watch.uuid, tag=active_tag_uuid)}}#general" class="pure-button pure-button-primary">Edit</a>
<a href="{{ url_for('ui.ui_views.diff_history_page', uuid=watch.uuid)}}" {{target_attr}} class="pure-button pure-button-primary history-link" style="display: none;">History</a>
<a href="{{ url_for('ui.ui_views.preview_page', uuid=watch.uuid)}}" {{target_attr}} class="pure-button pure-button-primary preview-link" style="display: none;">Preview</a>
<a href="{{ url_for('ui.ui_diff.diff_history_page', uuid=watch.uuid)}}" {{target_attr}} class="pure-button pure-button-primary history-link" style="display: none;">History</a>
<a href="{{ url_for('ui.ui_preview.preview_page', uuid=watch.uuid)}}" {{target_attr}} class="pure-button pure-button-primary preview-link" style="display: none;">Preview</a>
</div>
</td>
</tr>
@@ -66,7 +66,7 @@ def do_test(client, live_server, make_test_use_extra_browser=False):
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b'cool it works' in res.data
@@ -36,7 +36,7 @@ def test_fetch_webdriver_content(client, live_server, measure_memory_usage, data
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
logging.getLogger().info("Looking for correct fetched HTML (text) from server")
@@ -42,7 +42,7 @@ def test_execute_custom_js(client, live_server, measure_memory_usage, datastore_
# Check HTML conversion detected and workd
res = client.get(
url_for("ui.ui_views.preview_page", uuid=uuid),
url_for("ui.ui_preview.preview_page", uuid=uuid),
follow_redirects=True
)
assert b"This text should be removed" not in res.data
@@ -40,7 +40,7 @@ def test_select_custom(client, live_server, measure_memory_usage, datastore_path
assert b'Proxy Authentication Required' not in res.data
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
# We should see something via proxy
@@ -74,7 +74,7 @@ def test_socks5(client, live_server, measure_memory_usage, datastore_path):
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -61,7 +61,7 @@ def test_socks5_from_proxiesjson_file(client, live_server, measure_memory_usage,
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -49,7 +49,7 @@ def test_check_access_control(app, client, live_server, measure_memory_usage, da
assert b"Login" in res.data
# The diff page should return something valid when logged out
res = c.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
res = c.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
assert b'Random content' in res.data
# access to assets should work (check_authentication)
@@ -186,5 +186,5 @@ def test_check_access_control(app, client, live_server, measure_memory_usage, da
assert res.status_code == 403
# The diff page should return something valid when logged out
res = c.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
res = c.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
assert b'Random content' not in res.data
+1 -1
View File
@@ -189,7 +189,7 @@ def test_api_simple(client, live_server, measure_memory_usage, datastore_path):
assert watch.get('viewed') == False
# Loading the most recent snapshot should force viewed to become true
client.get(url_for("ui.ui_views.diff_history_page", uuid="first"), follow_redirects=True)
client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"), follow_redirects=True)
time.sleep(3)
# Fetch the whole watch again, viewed should be true
+1 -1
View File
@@ -26,7 +26,7 @@ def test_basic_auth(client, live_server, measure_memory_usage, datastore_path):
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
+7 -7
View File
@@ -45,7 +45,7 @@ def test_check_basic_change_detection_functionality(client, live_server, measure
# Check HTML conversion detected and workd
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
# Check this class does not appear (that we didnt see the actual source)
@@ -82,7 +82,7 @@ def test_check_basic_change_detection_functionality(client, live_server, measure
#
# Following the 'diff' link, it should no longer display as 'has-unread-changes' even after we recheck it a few times
res = client.get(url_for("ui.ui_views.diff_history_page", uuid=uuid))
res = client.get(url_for("ui.ui_diff.diff_history_page", uuid=uuid))
assert b'selected=""' in res.data, "Confirm diff history page loaded"
assert b'Which is across multiple lines' in res.data
@@ -91,7 +91,7 @@ def test_check_basic_change_detection_functionality(client, live_server, measure
# Check the [preview] pulls the right one
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b'which has this one new line' in res.data
@@ -273,7 +273,7 @@ got it\r\n
### check the front end
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b"some random text that should be split by line\n" in res.data
@@ -333,7 +333,7 @@ got it\r\n
### check the front end
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -378,7 +378,7 @@ def test_plaintext_even_if_xml_content(client, live_server, measure_memory_usage
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -405,7 +405,7 @@ def test_plaintext_even_if_xml_content_and_can_apply_filters(client, live_server
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -145,7 +145,7 @@ def test_check_block_changedetection_text_NOT_present(client, live_server, measu
client.get(url_for("ui.form_watch_checknow"), follow_redirects=True)
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid=uuid)
url_for("ui.ui_preview.preview_page", uuid=uuid)
)
assert b'blocked_line_numbers = [10]' in res.data
+1 -1
View File
@@ -291,7 +291,7 @@ def test_lev_conditions_plugin(client, live_server, measure_memory_usage, datast
# Check the content saved initially, even tho a condition was set - this is the first snapshot so shouldnt be affected by conditions
res = client.get(
url_for("ui.ui_views.preview_page", uuid=uuid),
url_for("ui.ui_preview.preview_page", uuid=uuid),
follow_redirects=True
)
assert b'Which is across multiple lines' in res.data
+1 -1
View File
@@ -157,7 +157,7 @@ def test_check_multiple_filters(client, live_server, measure_memory_usage, datas
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -192,7 +192,7 @@ def test_element_removal_full(client, live_server, measure_memory_usage, datasto
wait_for_all_checks(client)
# so that we set the state to 'has-unread-changes' after all the edits
client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
# Make a change to header/footer/nav
set_modified_response(datastore_path=datastore_path)
@@ -239,7 +239,7 @@ body > table > tr:nth-child(3) > td:nth-child(3)""",
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
+2 -2
View File
@@ -41,7 +41,7 @@ def test_check_encoding_detection(client, live_server, measure_memory_usage, dat
assert live_server.app.config['DATASTORE'].data['watching'][uuid]['content-type'] == "text/html"
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -63,7 +63,7 @@ def test_check_encoding_detection_missing_content_type_header(client, live_serve
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -34,7 +34,7 @@ def _runner_test_http_errors(client, live_server, http_code, expected_text, data
# Error viewing tabs should appear
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
+1 -1
View File
@@ -41,7 +41,7 @@ def test_check_extract_text_from_diff(client, live_server, measure_memory_usage,
wait_for_all_checks(client)
res = client.post(
url_for("ui.ui_views.diff_history_page", uuid="first"),
url_for("ui.ui_diff.diff_history_page", uuid="first"),
data={"extract_regex": "Now it's ([0-9\.]+)",
"extract_submit_button": "Extract as CSV"},
follow_redirects=False
@@ -107,7 +107,7 @@ def test_check_filter_multiline(client, live_server, measure_memory_usage, datas
assert b'not at the start of the expression' not in res.data
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
# Plaintext that doesnt look like a regex should match also
@@ -174,7 +174,7 @@ def test_check_filter_and_regex_extract(client, live_server, measure_memory_usag
# Check HTML conversion detected and workd
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
+2 -2
View File
@@ -94,7 +94,7 @@ def test_setup_group_tag(client, live_server, measure_memory_usage, datastore_pa
assert b'Warning, no filters were found' not in res.data
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b'Should be only this' in res.data
@@ -419,7 +419,7 @@ def test_order_of_filters_tag_filter_and_watch_filter(client, live_server, measu
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -100,7 +100,7 @@ def test_check_text_history_view(client, live_server, measure_memory_usage, data
client.get(url_for("ui.form_watch_checknow"), follow_redirects=True)
wait_for_all_checks(client)
res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
assert b'test-one' in res.data
assert b'test-two' in res.data
@@ -112,7 +112,7 @@ def test_check_text_history_view(client, live_server, measure_memory_usage, data
wait_for_all_checks(client)
# It should remember the last viewed time, so the first difference is not shown
res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
assert b'test-three' in res.data
assert b'test-two' in res.data
assert b'test-one' not in res.data
+2 -2
View File
@@ -49,7 +49,7 @@ def test_ignore(client, live_server, measure_memory_usage, datastore_path):
assert b'href' in res.data
# It should not be in the preview anymore
res = client.get(url_for("ui.ui_views.preview_page", uuid=uuid))
res = client.get(url_for("ui.ui_preview.preview_page", uuid=uuid))
assert b'<div class="ignored">oh yeah 456' not in res.data
# Should be in base.html
@@ -84,6 +84,6 @@ def test_strip_ignore_lines(client, live_server, measure_memory_usage, datastore
uuid = next(iter(live_server.app.config['DATASTORE'].data['watching']))
# It should not be in the preview anymore
res = client.get(url_for("ui.ui_views.preview_page", uuid=uuid))
res = client.get(url_for("ui.ui_preview.preview_page", uuid=uuid))
assert b'<div class="ignored">' not in res.data
assert b'Which is across multiple' not in res.data
+2 -2
View File
@@ -131,7 +131,7 @@ def test_check_ignore_text_functionality(client, live_server, measure_memory_usa
assert b'/test-endpoint' in res.data
res = client.get(url_for("ui.ui_views.preview_page", uuid="first"))
res = client.get(url_for("ui.ui_preview.preview_page", uuid="first"))
# nothing ignored because none of the text matched
assert b'ignored_line_numbers = []' in res.data
@@ -158,7 +158,7 @@ def test_check_ignore_text_functionality(client, live_server, measure_memory_usa
res = client.get(url_for("watchlist.index"))
assert b'has-unread-changes' in res.data
res = client.get(url_for("ui.ui_views.preview_page", uuid="first"))
res = client.get(url_for("ui.ui_preview.preview_page", uuid="first"))
# SHOULD BE be in the preview, it was added in set_modified_original_ignore_response()
# and we have "new ignore stuff" in ignore_text
@@ -82,7 +82,7 @@ def test_render_anchor_tag_content_true(client, live_server, measure_memory_usag
wait_for_all_checks(client)
# We should not see the rendered anchor tag
res = client.get(url_for("ui.ui_views.preview_page", uuid="first"))
res = client.get(url_for("ui.ui_preview.preview_page", uuid="first"))
assert '(/modified_link)' not in res.data.decode()
# Goto the settings page, ENABLE render anchor tag
@@ -106,7 +106,7 @@ def test_render_anchor_tag_content_true(client, live_server, measure_memory_usag
# check that the anchor tag content is rendered
res = client.get(url_for("ui.ui_views.preview_page", uuid="first"))
res = client.get(url_for("ui.ui_preview.preview_page", uuid="first"))
assert '(/modified_link)' in res.data.decode()
# since the link has changed, and we chose to render anchor tag content,
+2 -2
View File
@@ -30,7 +30,7 @@ def test_jinja2_in_url_query(client, live_server, measure_memory_usage, datastor
# It should report nothing found (no new 'has-unread-changes' class)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b'date=2' in res.data
@@ -56,7 +56,7 @@ def test_jinja2_time_offset_in_url_query(client, live_server, measure_memory_usa
# Verify the URL was processed correctly (should not have errors)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
# Should have a valid timestamp in the response
@@ -210,7 +210,7 @@ def test_check_json_without_filter(client, live_server, measure_memory_usage, da
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -253,7 +253,7 @@ def check_json_filter(json_filter, client, live_server, datastore_path):
assert b'has-unread-changes' in res.data
# Should not see this, because its not in the JSONPath we entered
res = client.get(url_for("ui.ui_views.diff_history_page", uuid=uuid))
res = client.get(url_for("ui.ui_diff.diff_history_page", uuid=uuid))
# But the change should be there, tho its hard to test the change was detected because it will show old and new versions
# And #462 - check we see the proper utf-8 string there
@@ -289,7 +289,7 @@ def check_json_filter_bool_val(json_filter, client, live_server, datastore_path)
# Give the thread time to pick it up
wait_for_all_checks(client)
res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
# But the change should be there, tho its hard to test the change was detected because it will show old and new versions
assert b'false' in res.data
@@ -361,7 +361,7 @@ def check_json_ext_filter(json_filter, client, live_server, datastore_path):
res = client.get(url_for("watchlist.index"))
assert b'has-unread-changes' in res.data
res = client.get(url_for("ui.ui_views.preview_page", uuid="first"))
res = client.get(url_for("ui.ui_preview.preview_page", uuid="first"))
# We should never see 'ForSale' because we are selecting on 'Sold' in the rule,
# But we should know it triggered ('has-unread-changes' assert above)
@@ -371,7 +371,7 @@ def check_json_ext_filter(json_filter, client, live_server, datastore_path):
# And the difference should have both?
res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
assert b'ForSale' in res.data
assert b'Sold' in res.data
@@ -432,7 +432,7 @@ def test_correct_header_detect(client, live_server, measure_memory_usage, datast
assert b'No parsable JSON found in this document' not in res.data
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
+1 -1
View File
@@ -33,7 +33,7 @@ def test_obfuscations(client, live_server, measure_memory_usage, datastore_path)
# Check HTML conversion detected and workd
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
+2 -2
View File
@@ -56,7 +56,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path):
# The original checksum should be not be here anymore (cdio adds it to the bottom of the text)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -64,7 +64,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path):
assert changed_md5.encode('utf-8') in res.data
res = client.get(
url_for("ui.ui_views.diff_history_page", uuid="first"),
url_for("ui.ui_diff.diff_history_page", uuid="first"),
follow_redirects=True
)
@@ -20,7 +20,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path):
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -50,7 +50,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path):
# The original checksum should be not be here anymore (cdio adds it to the bottom of the text)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -58,7 +58,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path):
assert changed_md5.encode('utf-8') in res.data
res = client.get(
url_for("ui.ui_views.diff_history_page", uuid="first"),
url_for("ui.ui_diff.diff_history_page", uuid="first"),
follow_redirects=True
)
+6 -6
View File
@@ -48,7 +48,7 @@ def test_headers_in_request(client, live_server, measure_memory_usage, datastore
# The service should echo back the request headers
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -126,7 +126,7 @@ def test_body_in_request(client, live_server, measure_memory_usage, datastore_pa
# The service should echo back the body
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -215,7 +215,7 @@ def test_method_in_request(client, live_server, measure_memory_usage, datastore_
# The service should echo back the request verb
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -257,7 +257,7 @@ def test_ua_global_override(client, live_server, measure_memory_usage, datastore
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -281,7 +281,7 @@ def test_ua_global_override(client, live_server, measure_memory_usage, datastore
assert b"Updated watch." in res.data
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b"agent-from-watch" in res.data
@@ -376,7 +376,7 @@ def test_headers_textfile_in_request(client, live_server, measure_memory_usage,
# The service should echo back the request verb
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
+2 -2
View File
@@ -124,7 +124,7 @@ def test_basic_cdata_rss_markup(client, live_server, measure_memory_usage, datas
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b'CDATA' not in res.data
@@ -166,7 +166,7 @@ def test_rss_xpath_filtering(client, live_server, measure_memory_usage, datastor
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b'CDATA' not in res.data
+3 -3
View File
@@ -101,7 +101,7 @@ def _runner_test_various_file_slash(client, file_uri):
if file_uri.startswith('file:///'):
# This one should be the full qualified path to the file and should get the contents of this file
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b'_runner_test_various_file_slash' in res.data
@@ -154,9 +154,9 @@ def test_xss(client, live_server, measure_memory_usage, datastore_path):
live_server.app.config['DATASTORE'].data['watching'][uuid]['url']=XSS_HACK
res = client.get(url_for("ui.ui_views.preview_page", uuid=uuid))
res = client.get(url_for("ui.ui_preview.preview_page", uuid=uuid))
assert XSS_HACK.encode('utf-8') not in res.data and res.status_code == 200
client.get(url_for("ui.ui_views.diff_history_page", uuid=uuid))
client.get(url_for("ui.ui_diff.diff_history_page", uuid=uuid))
assert XSS_HACK.encode('utf-8') not in res.data and res.status_code == 200
res = client.get(url_for("watchlist.index"))
assert XSS_HACK.encode('utf-8') not in res.data and res.status_code == 200
+3 -3
View File
@@ -22,7 +22,7 @@ def test_check_basic_change_detection_functionality_source(client, live_server,
# Check HTML conversion detected and workd
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -43,7 +43,7 @@ def test_check_basic_change_detection_functionality_source(client, live_server,
assert b'has-unread-changes' in res.data
res = client.get(
url_for("ui.ui_views.diff_history_page", uuid="first"),
url_for("ui.ui_diff.diff_history_page", uuid="first"),
follow_redirects=True
)
# With diff-match-patch, HTML tags are properly tokenized and excluded from diff spans
@@ -75,7 +75,7 @@ def test_check_ignore_elements(client, live_server, measure_memory_usage, datast
time.sleep(sleep_time_for_fetch_thread)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
assert b'foobar-detection' not in res.data
+3 -3
View File
@@ -96,7 +96,7 @@ def test_trigger_functionality(client, live_server, measure_memory_usage, datast
# so that we set the state to 'has-unread-changes' after all the edits
client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
# Trigger a check
client.get(url_for("ui.form_watch_checknow"), follow_redirects=True)
@@ -129,11 +129,11 @@ def test_trigger_functionality(client, live_server, measure_memory_usage, datast
# https://github.com/dgtlmoon/changedetection.io/issues/616
# Apparently the actual snapshot that contains the trigger never shows
res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
assert b'Add to cart' in res.data
# Check the preview/highlighter, we should be able to see what we triggered on, but it should be highlighted
res = client.get(url_for("ui.ui_views.preview_page", uuid="first"))
res = client.get(url_for("ui.ui_preview.preview_page", uuid="first"))
assert b'ignored_line_numbers = [8]' in res.data
# We should be able to see what we triggered on
@@ -52,7 +52,7 @@ def test_trigger_regex_functionality(client, live_server, measure_memory_usage,
)
wait_for_all_checks(client)
# so that we set the state to 'has-unread-changes' after all the edits
client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
with open(os.path.join(datastore_path, "endpoint-content.txt"), "w") as f:
f.write("some new noise")
@@ -55,7 +55,7 @@ def test_trigger_regex_functionality_with_filter(client, live_server, measure_me
# Give the thread time to pick it up
time.sleep(sleep_time_for_fetch_thread)
client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
# Check that we have the expected text.. but it's not in the css filter we want
with open(os.path.join(datastore_path, "endpoint-content.txt"), "w") as f:
+1 -1
View File
@@ -269,7 +269,7 @@ def test_ui_viewed_unread_flag(client, live_server, measure_memory_usage, datast
assert res.data.count(b'data-watch-uuid') == 2
# one should now be viewed, but two in total still
client.get(url_for("ui.ui_views.diff_history_page", uuid="first"))
client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"))
res = client.get(url_for("watchlist.index"))
assert b'<span id="unread-tab-counter">1</span>' in res.data
assert res.data.count(b'data-watch-uuid') == 2
+2 -2
View File
@@ -152,7 +152,7 @@ def test_sort_lines_functionality(client, live_server, measure_memory_usage, dat
assert b'has-unread-changes' in res.data
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -195,7 +195,7 @@ def test_extra_filters(client, live_server, measure_memory_usage, datastore_path
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first")
url_for("ui.ui_preview.preview_page", uuid="first")
)
assert res.data.count(b"see what happens.") == 1
@@ -178,7 +178,7 @@ def test_check_xpath_text_function_utf8(client, live_server, measure_memory_usag
# The service should echo back the request headers
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -214,7 +214,7 @@ def test_check_markup_xpath_filter_restriction(client, live_server, measure_memo
wait_for_all_checks(client)
# view it/reset state back to viewed
client.get(url_for("ui.ui_views.diff_history_page", uuid="first"), follow_redirects=True)
client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"), follow_redirects=True)
# Make a change
set_modified_response(datastore_path=datastore_path)
@@ -310,7 +310,7 @@ def test_xpath1_lxml(client, live_server, measure_memory_usage, datastore_path):
assert b'_ElementStringResult' not in res.data # tested with 5.1.1 when it was removed and 5.1.0
assert b'Exception' not in res.data
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -359,7 +359,7 @@ def test_check_with_prefix_include_filters(client, live_server, measure_memory_u
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -437,7 +437,7 @@ def test_xpath_20(client, live_server, measure_memory_usage, datastore_path):
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -471,7 +471,7 @@ def test_xpath_20_function_count(client, live_server, measure_memory_usage, data
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -504,7 +504,7 @@ def test_xpath_20_function_count2(client, live_server, measure_memory_usage, dat
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -538,7 +538,7 @@ def test_xpath_20_function_string_join_matches(client, live_server, measure_memo
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid=uuid),
url_for("ui.ui_preview.preview_page", uuid=uuid),
follow_redirects=True
)
@@ -575,7 +575,7 @@ def _subtest_xpath_rss(client, datastore_path, content_type='text/html'):
wait_for_all_checks(client)
res = client.get(
url_for("ui.ui_views.preview_page", uuid="first"),
url_for("ui.ui_preview.preview_page", uuid="first"),
follow_redirects=True
)
@@ -47,7 +47,7 @@ def test_visual_selector_content_ready(client, live_server, measure_memory_usage
assert live_server.app.config['DATASTORE'].data['watching'][uuid].history_n >= 1, "Watch history had atleast 1 (everything fetched OK)"
res = client.get(
url_for("ui.ui_views.preview_page", uuid=uuid),
url_for("ui.ui_preview.preview_page", uuid=uuid),
follow_redirects=True
)
assert b"testheader: yes" in res.data
@@ -131,7 +131,7 @@ def test_basic_browserstep(client, live_server, measure_memory_usage, datastore_
# Check HTML conversion detected and workd
res = client.get(
url_for("ui.ui_views.preview_page", uuid=uuid),
url_for("ui.ui_preview.preview_page", uuid=uuid),
follow_redirects=True
)
assert b"This text should be removed" not in res.data