Fixing bad linebreak definition `</br>` in notifications and UI (#1465)

pull/1467/head
dgtlmoon 1 year ago committed by GitHub
parent 0d05ee1586
commit 6f1eec0d5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -361,7 +361,7 @@ def changedetection_app(config=None, datastore_o=None):
fe.title(title=watch_title)
latest_fname = watch.history[dates[-1]]
html_diff = diff.render_diff(prev_fname, latest_fname, include_equal=False, line_feed_sep="</br>")
html_diff = diff.render_diff(prev_fname, latest_fname, include_equal=False, line_feed_sep="<br>")
fe.content(content="<html><body><h4>{}</h4>{}</body></html>".format(watch_title, html_diff),
type='CDATA')

@ -30,7 +30,7 @@ def customSequenceMatcher(before, after, include_equal=False, include_removed=Tr
yield g
# only_differences - only return info about the differences, no context
# line_feed_sep could be "<br/>" or "<li>" or "\n" etc
# line_feed_sep could be "<br>" or "<li>" or "\n" etc
def render_diff(previous_file, newest_file, include_equal=False, include_removed=True, include_added=True, line_feed_sep="\n"):
with open(newest_file, 'r') as f:
newest_version_file_contents = f.read()

@ -147,12 +147,12 @@ class ValidateContentFetcherIsReady(object):
except urllib3.exceptions.MaxRetryError as e:
driver_url = some_object.command_executor
message = field.gettext('Content fetcher \'%s\' did not respond.' % (field.data))
message += '<br/>' + field.gettext(
message += '<br>' + field.gettext(
'Be sure that the selenium/webdriver runner is running and accessible via network from this container/host.')
message += '<br/>' + field.gettext('Did you follow the instructions in the wiki?')
message += '<br/><br/>' + field.gettext('WebDriver Host: %s' % (driver_url))
message += '<br/><a href="https://github.com/dgtlmoon/changedetection.io/wiki/Fetching-pages-with-WebDriver">Go here for more information</a>'
message += '<br/>'+field.gettext('Content fetcher did not respond properly, unable to use it.\n %s' % (str(e)))
message += '<br>' + field.gettext('Did you follow the instructions in the wiki?')
message += '<br><br>' + field.gettext('WebDriver Host: %s' % (driver_url))
message += '<br><a href="https://github.com/dgtlmoon/changedetection.io/wiki/Fetching-pages-with-WebDriver">Go here for more information</a>'
message += '<br>'+field.gettext('Content fetcher did not respond properly, unable to use it.\n %s' % (str(e)))
raise ValidationError(message)

@ -8,7 +8,7 @@ import json
import re
# HTML added to be sure each result matching a filter (.example) gets converted to a new line by Inscriptis
TEXT_FILTER_LIST_LINE_SUFFIX = "<br/>"
TEXT_FILTER_LIST_LINE_SUFFIX = "<br>"
# 'price' , 'lowPrice', 'highPrice' are usually under here
# all of those may or may not appear on different websites

@ -122,10 +122,10 @@ def process_notification(n_object, datastore):
url += k + 'avatar_url=https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/changedetectionio/static/images/avatar-256x256.png'
if url.startswith('tgram://'):
# Telegram only supports a limit subset of HTML, remove the '<br/>' we place in.
# Telegram only supports a limit subset of HTML, remove the '<br>' we place in.
# re https://github.com/dgtlmoon/changedetection.io/issues/555
# @todo re-use an existing library we have already imported to strip all non-allowed tags
n_body = n_body.replace('<br/>', '\n')
n_body = n_body.replace('<br>', '\n')
n_body = n_body.replace('</br>', '\n')
# real limit is 4096, but minus some for extra metadata
payload_max_size = 3600

@ -107,7 +107,7 @@
</table>
<div class="pure-form-message-inline">
<br>
URLs generated by changedetection.io (such as <code>{{ '{{diff_url}}' }}</code>) require the <code>BASE_URL</code> environment variable set.<br/>
URLs generated by changedetection.io (such as <code>{{ '{{diff_url}}' }}</code>) require the <code>BASE_URL</code> environment variable set.<br>
Your <code>BASE_URL</code> var is currently "{{settings_application['current_base_url']}}"
<br>
Warning: Contents of <code>{{ '{{diff}}' }}</code>, <code>{{ '{{diff_removed}}' }}</code>, and <code>{{ '{{diff_added}}' }}</code> depend on how the difference algorithm perceives the change. For example, an addition or removal could be perceived as a change in some cases. <a target="_new" href="https://github.com/dgtlmoon/changedetection.io/wiki/Using-the-%7B%7Bdiff%7D%7D,-%7B%7Bdiff_added%7D%7D,-and-%7B%7Bdiff_removal%7D%7D-notification-tokens">More Here</a> </br>

@ -124,12 +124,12 @@
<div class="pure-control-group">
{{ render_field(extract_form.extract_regex) }}
<span class="pure-form-message-inline">
A <strong>RegEx</strong> is a pattern that identifies exactly which part inside of the text that you want to extract.<br/>
A <strong>RegEx</strong> is a pattern that identifies exactly which part inside of the text that you want to extract.<br>
<p>
For example, to extract only the numbers from text &dash;</br>
<strong>Raw text</strong>: <code>Temperature <span style="color: red">5.5</span>°C in Sydney</code></br>
<strong>RegEx to extract:</strong> <code>Temperature <span style="color: red">([0-9\.]+)</span></code><br/>
For example, to extract only the numbers from text &dash;<br>
<strong>Raw text</strong>: <code>Temperature <span style="color: red">5.5</span>°C in Sydney</code><br>
<strong>RegEx to extract:</strong> <code>Temperature <span style="color: red">([0-9\.]+)</span></code><br>
</p>
<p>
<a href="https://RegExr.com/">Be sure to test your RegEx here.</a>
@ -154,4 +154,4 @@
<script type="text/javascript" src="{{url_for('static_content', group='js', filename='diff-render.js')}}"></script>
{% endblock %}
{% endblock %}

@ -49,8 +49,8 @@
<fieldset>
<div class="pure-control-group">
{{ render_field(form.url, placeholder="https://...", required=true, class="m-d") }}
<span class="pure-form-message-inline">Some sites use JavaScript to create the content, for this you should <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Fetching-pages-with-WebDriver">use the Chrome/WebDriver Fetcher</a></span><br/>
<span class="pure-form-message-inline">You can use variables in the URL, perfect for inserting the current date and other logic, <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Handling-variables-in-the-watched-URL">help and examples here</a></span><br/>
<span class="pure-form-message-inline">Some sites use JavaScript to create the content, for this you should <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Fetching-pages-with-WebDriver">use the Chrome/WebDriver Fetcher</a></span><br>
<span class="pure-form-message-inline">You can use variables in the URL, perfect for inserting the current date and other logic, <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Handling-variables-in-the-watched-URL">help and examples here</a></span><br>
</div>
<div class="pure-control-group">
{{ render_field(form.title, class="m-d") }}
@ -106,10 +106,10 @@
{{ render_field(form.webdriver_delay) }}
<div class="pure-form-message-inline">
<strong>If you're having trouble waiting for the page to be fully rendered (text missing etc), try increasing the 'wait' time here.</strong>
<br/>
<br>
This will wait <i>n</i> seconds before extracting the text.
{% if using_global_webdriver_wait %}
<br/><strong>Using the current global default settings</strong>
<br><strong>Using the current global default settings</strong>
{% endif %}
</div>
</div>
@ -216,7 +216,7 @@ User-Agent: wonderbra 1.0") }}
<div class="tab-pane-inner" id="filters-and-triggers">
<div class="pure-control-group">
<strong>Pro-tips:</strong><br/>
<strong>Pro-tips:</strong><br>
<ul>
<li>
Use the preview page to see your filters and triggers highlighted.
@ -241,9 +241,9 @@ xpath://body/div/span[contains(@class, 'example-class')]",
%}
{{ field }}
{% if '/text()' in field %}
<span class="pure-form-message-inline"><strong>Note!: //text() function does not work where the &lt;element&gt; contains &lt;![CDATA[]]&gt;</strong></span><br/>
<span class="pure-form-message-inline"><strong>Note!: //text() function does not work where the &lt;element&gt; contains &lt;![CDATA[]]&gt;</strong></span><br>
{% endif %}
<span class="pure-form-message-inline">One rule per line, <i>any</i> rules that matches will be used.<br/>
<span class="pure-form-message-inline">One rule per line, <i>any</i> rules that matches will be used.<br>
<ul>
<li>CSS - Limit text to this CSS rule, only text matching this CSS rule is included.</li>
@ -266,7 +266,7 @@ xpath://body/div/span[contains(@class, 'example-class')]",
</li>
</ul>
Please be sure that you thoroughly understand how to write CSS, JSONPath, XPath{% if jq_support %}, or jq selector{%endif%} rules before filing an issue on GitHub! <a
href="https://github.com/dgtlmoon/changedetection.io/wiki/CSS-Selector-help">here for more CSS selector help</a>.<br/>
href="https://github.com/dgtlmoon/changedetection.io/wiki/CSS-Selector-help">here for more CSS selector help</a>.<br>
</span>
</div>
<div class="pure-control-group">
@ -334,7 +334,7 @@ Unavailable") }}
<li>Extracts text in the final output (line by line) after other filters using regular expressions;
<ul>
<li>Regular expression &dash; example <code>/reports.+?2022/i</code></li>
<li>Use <code>//(?aiLmsux))</code> type flags (more <a href="https://docs.python.org/3/library/re.html#index-15">information here</a>)<br/></li>
<li>Use <code>//(?aiLmsux))</code> type flags (more <a href="https://docs.python.org/3/library/re.html#index-15">information here</a>)<br></li>
<li>Keyword example &dash; example <code>Out of stock</code></li>
<li>Use groups to extract just that text &dash; example <code>/reports.+?(\d+)/i</code> returns a list of years only</li>
</ul>
@ -353,7 +353,7 @@ Unavailable") }}
<div class="pure-control-group">
{% if visualselector_enabled %}
<span class="pure-form-message-inline">
The Visual Selector tool lets you select the <i>text</i> elements that will be used for the change detection &dash; after the <i>Browser Steps</i> has completed.<br/><br/>
The Visual Selector tool lets you select the <i>text</i> elements that will be used for the change detection &dash; after the <i>Browser Steps</i> has completed.<br><br>
</span>
<div id="selector-header">

@ -41,12 +41,12 @@
<fieldset class="pure-group">
<legend>
Copy and Paste your Distill.io watch 'export' file, this should be a JSON file.</br>
Copy and Paste your Distill.io watch 'export' file, this should be a JSON file.<br>
This is <i>experimental</i>, supported fields are <code>name</code>, <code>uri</code>, <code>tags</code>, <code>config:selections</code>, the rest (including <code>schedule</code>) are ignored.
<br/>
<br>
<p>
How to export? <a href="https://distill.io/docs/web-monitor/how-export-and-import-monitors/">https://distill.io/docs/web-monitor/how-export-and-import-monitors/</a><br/>
Be sure to set your default fetcher to Chrome if required.</br>
How to export? <a href="https://distill.io/docs/web-monitor/how-export-and-import-monitors/">https://distill.io/docs/web-monitor/how-export-and-import-monitors/</a><br>
Be sure to set your default fetcher to Chrome if required.<br>
</p>
</legend>

@ -54,7 +54,7 @@
<div class="tip">
For now, Differences are performed on text, not graphically, only the latest screenshot is available.
</div>
</br>
<br>
{% if is_html_webdriver %}
{% if screenshot %}
<div class="snapshot-age">{{watch.snapshot_screenshot_ctime|format_timestamp_timeago}}</div>
@ -67,4 +67,4 @@
{% endif %}
</div>
</div>
{% endblock %}
{% endblock %}

@ -40,7 +40,7 @@
<div class="pure-control-group">
{{ render_field(form.application.form.filter_failure_notification_threshold_attempts, class="filter_failure_notification_threshold_attempts") }}
<span class="pure-form-message-inline">After this many consecutive times that the CSS/xPath filter is missing, send a notification
<br/>
<br>
Set to <strong>0</strong> to disable
</span>
</div>
@ -66,7 +66,7 @@
{{ render_field(form.application.form.base_url, placeholder="http://yoursite.com:5000/",
class="m-d") }}
<span class="pure-form-message-inline">
Base URL used for the <code>{{ '{{ base_url }}' }}</code> token in notifications and RSS links.<br/>Default value is the ENV var 'BASE_URL' (Currently "{{settings_application['current_base_url']}}"),
Base URL used for the <code>{{ '{{ base_url }}' }}</code> token in notifications and RSS links.<br>Default value is the ENV var 'BASE_URL' (Currently "{{settings_application['current_base_url']}}"),
<a href="https://github.com/dgtlmoon/changedetection.io/wiki/Configurable-BASE_URL-setting">read more here</a>.
</span>
</div>
@ -105,13 +105,13 @@
<p>Use the <strong>Basic</strong> method (default) where your watched sites don't need Javascript to render.</p>
<p>The <strong>Chrome/Javascript</strong> method requires a network connection to a running WebDriver+Chrome server, set by the ENV var 'WEBDRIVER_URL'. </p>
</span>
<br/>
<br>
Tip: <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Proxy-configuration#brightdata-proxy-support">Connect using BrightData Proxies, find out more here.</a>
</div>
<fieldset class="pure-group" id="webdriver-override-options">
<div class="pure-form-message-inline">
<strong>If you're having trouble waiting for the page to be fully rendered (text missing etc), try increasing the 'wait' time here.</strong>
<br/>
<br>
This will wait <i>n</i> seconds before extracting the text.
</div>
<div class="pure-control-group">
@ -124,14 +124,14 @@
<fieldset class="pure-group">
{{ render_checkbox_field(form.application.form.ignore_whitespace) }}
<span class="pure-form-message-inline">Ignore whitespace, tabs and new-lines/line-feeds when considering if a change was detected.<br/>
<span class="pure-form-message-inline">Ignore whitespace, tabs and new-lines/line-feeds when considering if a change was detected.<br>
<i>Note:</i> Changing this will change the status of your existing watches, possibly trigger alerts etc.
</span>
</fieldset>
<fieldset class="pure-group">
{{ render_checkbox_field(form.application.form.render_anchor_tag_content) }}
<span class="pure-form-message-inline">Render anchor tag content, default disabled, when enabled renders links as <code>(link text)[https://somesite.com]</code>
<br/>
<br>
<i>Note:</i> Changing this could affect the content of your existing watches, possibly trigger alerts etc.
</span>
</fieldset>
@ -151,7 +151,7 @@ nav
{{ render_field(form.application.form.global_ignore_text, rows=5, placeholder="Some text to ignore in a line
/some.regex\d{2}/ for case-INsensitive regex
") }}
<span class="pure-form-message-inline">Note: This is applied globally in addition to the per-watch rules.</span><br/>
<span class="pure-form-message-inline">Note: This is applied globally in addition to the per-watch rules.</span><br>
<span class="pure-form-message-inline">
<ul>
<li>Note: This is applied globally in addition to the per-watch rules.</li>
@ -170,8 +170,8 @@ nav
<div class="pure-control-group">
{{ render_checkbox_field(form.application.form.api_access_token_enabled) }}
<div class="pure-form-message-inline">Restrict API access limit by using <code>x-api-key</code> header</div><br/>
<div class="pure-form-message-inline"><br/>API Key <span id="api-key">{{api_key}}</span>
<div class="pure-form-message-inline">Restrict API access limit by using <code>x-api-key</code> header</div><br>
<div class="pure-form-message-inline"><br>API Key <span id="api-key">{{api_key}}</span>
<span style="display:none;" id="api-key-copy" >copy</span>
</div>
</div>
@ -181,7 +181,7 @@ nav
<p><strong>Tip</strong>: You can connect to websites using <a href="https://brightdata.grsm.io/n0r16zf7eivq">BrightData</a> proxies, their service <strong>WebUnlocker</strong> will solve most CAPTCHAs, whilst their <strong>Residential Proxies</strong> may help to avoid CAPTCHA altogether. </p>
<p>It may be easier to try <strong>WebUnlocker</strong> first, WebUnlocker also supports country selection.</p>
<p>
When you have <a href="https://brightdata.grsm.io/n0r16zf7eivq">registered</a>, enabled the required services, visit the <A href="https://brightdata.com/cp/api_example?">API example page</A>, then select <strong>Python</strong>, set the country you wish to use, then copy+paste the example URL below<br/>
When you have <a href="https://brightdata.grsm.io/n0r16zf7eivq">registered</a>, enabled the required services, visit the <A href="https://brightdata.com/cp/api_example?">API example page</A>, then select <strong>Python</strong>, set the country you wish to use, then copy+paste the example URL below<br>
The Proxy URL with BrightData should start with <code>http://brd-customer...</code>
</p>

@ -11,10 +11,10 @@ import uuid
def set_original_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="sametext">Some text thats the same</div>
<div id="changetext">Some text that will change</div>
</body>
@ -29,10 +29,10 @@ def set_original_response():
def set_modified_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>which has this one new line</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="sametext">Some text thats the same</div>
<div id="changetext">Some text that changes</div>
</body>

@ -7,10 +7,10 @@ from .util import live_server_setup, extract_UUID_from_client, extract_api_key_f
def set_response_with_ldjson():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div class="sametext">Some text thats the same</div>
<div class="changetext">Some text that will change</div>
<script type="application/ld+json">
@ -61,10 +61,10 @@ def set_response_with_ldjson():
def set_response_without_ldjson():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div class="sametext">Some text thats the same</div>
<div class="changetext">Some text that will change</div>
</body>
@ -143,4 +143,4 @@ def test_check_ldjson_price_autodetect(client, live_server):
assert b'ldjson-price-track-offer' not in res.data
##########################################################################################
client.get(url_for("form_delete", uuid="all"), follow_redirects=True)
client.get(url_for("form_delete", uuid="all"), follow_redirects=True)

@ -11,7 +11,7 @@ sleep_time_for_fetch_thread = 3
# Basic test to check inscriptus is not adding return line chars, basically works etc
def test_inscriptus():
from inscriptis import get_text
html_content = "<html><body>test!<br/>ok man</body></html>"
html_content = "<html><body>test!<br>ok man</body></html>"
stripped_text_from_html = get_text(html_content)
assert stripped_text_from_html == 'test!\nok man'

@ -8,10 +8,10 @@ from changedetectionio import html_tools
def set_original_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
@ -24,10 +24,10 @@ def set_original_ignore_response():
def set_modified_original_ignore_response():
test_return_data = """<html>
<body>
Some NEW nice initial text</br>
Some NEW nice initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<p>new ignore stuff</p>
<p>out of stock</p>
<p>blah</p>
@ -44,11 +44,11 @@ def set_modified_original_ignore_response():
def set_modified_response_minus_block_text():
test_return_data = """<html>
<body>
Some NEW nice initial text</br>
Some NEW nice initial text<br>
<p>Which is across multiple lines</p>
<p>now on sale $2/p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<p>new ignore stuff</p>
<p>blah</p>
</body>

@ -12,10 +12,10 @@ def test_setup(live_server):
def set_original_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="sametext">Some text thats the same</div>
<div id="changetext">Some text that will change</div>
</body>
@ -29,10 +29,10 @@ def set_original_response():
def set_modified_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>which has this one new line</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="sametext">Some text thats the same</div>
<div id="changetext">Some text that changes</div>
</body>

@ -25,10 +25,10 @@ def set_original_response():
</ul>
</nav>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="changetext">Some text that will change</div>
</body>
<footer>
@ -54,10 +54,10 @@ def set_modified_response():
</ul>
</nav>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="changetext">Some text that changes</div>
</body>
<footer>
@ -85,7 +85,7 @@ def test_element_removal_output():
</ul>
</nav>
<body>
Some initial text</br>
Some initial text<br>
<p>across multiple lines</p>
<div id="changetext">Some text that changes</div>
</body>

@ -10,10 +10,10 @@ from ..html_tools import *
def set_original_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="sametext">Some text thats the same</div>
<div class="changetext">Some text that will change</div>
</body>
@ -28,12 +28,12 @@ def set_original_response():
def set_modified_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>which has this one new line</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="sametext">Some text thats the same</div>
<div class="changetext">Some text that did change ( 1000 online <br/> 80 guests<br/> 2000 online )</div>
<div class="changetext">Some text that did change ( 1000 online <br> 80 guests<br> 2000 online )</div>
<div class="changetext">SomeCase insensitive 3456</div>
</body>
</html>
@ -49,8 +49,8 @@ def set_multiline_response():
test_return_data = """<html>
<body>
<p>Something <br/>
across 6 billion multiple<br/>
<p>Something <br>
across 6 billion multiple<br>
lines
</p>

@ -11,10 +11,10 @@ from changedetectionio.model import App
def set_response_without_filter():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="nope-doesnt-exist">Some text thats the same</div>
</body>
</html>
@ -28,10 +28,10 @@ def set_response_without_filter():
def set_response_with_filter():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div class="ticket-available">Ticket now on sale!</div>
</body>
</html>

@ -8,10 +8,10 @@ from changedetectionio.model import App
def set_response_with_filter():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div id="nope-doesnt-exist">Some text thats the same</div>
</body>
</html>
@ -145,4 +145,4 @@ def test_check_xpath_filter_failure_notification(client, live_server):
time.sleep(1)
run_filter_test(client, '//*[@id="nope-doesnt-exist"]')
# Test that notification is never sent
# Test that notification is never sent

@ -6,11 +6,11 @@ from ..html_tools import html_to_text
def test_html_to_text_func():
test_html = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
<a href="/first_link"> More Text </a>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<a href="second_link.com"> Even More Text </a>
</body>
</html>
@ -21,7 +21,7 @@ def test_html_to_text_func():
no_links_text = \
"Some initial text\n\nWhich is across multiple " \
"lines\n\nMore Text So let's see what happens. Even More Text"
"lines\n\nMore Text\nSo let's see what happens.\nEven More Text"
# check that no links are in the extracted text
assert text_content == no_links_text
@ -31,7 +31,7 @@ def test_html_to_text_func():
links_text = \
"Some initial text\n\nWhich is across multiple lines\n\n[ More Text " \
"](/first_link) So let's see what happens. [ Even More Text ]" \
"](/first_link)\nSo let's see what happens.\n[ Even More Text ]" \
"(second_link.com)"
# check that links are present in the extracted text

@ -33,10 +33,10 @@ def test_strip_text_func():
def set_original_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
@ -49,10 +49,10 @@ def set_original_ignore_response():
def set_modified_original_ignore_response():
test_return_data = """<html>
<body>
Some NEW nice initial text</br>
Some NEW nice initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<p>new ignore stuff</p>
<p>blah</p>
</body>
@ -68,11 +68,11 @@ def set_modified_original_ignore_response():
def set_modified_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
<P>ZZZZz</P>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>

@ -12,10 +12,10 @@ def test_setup(live_server):
def set_original_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<a href="/original_link"> Some More Text </a>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
"""
@ -29,10 +29,10 @@ def set_original_ignore_response():
def set_modified_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<a href="/modified_link"> Some More Text </a>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
"""

@ -12,10 +12,10 @@ def test_setup(live_server):
def set_original_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
"""
@ -27,10 +27,10 @@ def set_original_response():
def set_some_changed_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines, and a new thing too.</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
"""

@ -12,15 +12,15 @@ def test_setup(live_server):
def set_original_ignore_response_but_with_whitespace():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>
Which is across multiple lines</p>
<br>
</br>
<br>
So let's see what happens. </br>
So let's see what happens. <br>
</body>
@ -34,10 +34,10 @@ def set_original_ignore_response_but_with_whitespace():
def set_original_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>

@ -8,10 +8,10 @@ from . util import live_server_setup
def set_original_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
@ -24,10 +24,10 @@ def set_original_ignore_response():
def set_modified_original_ignore_response():
test_return_data = """<html>
<body>
Some NEW nice initial text</br>
Some NEW nice initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
@ -40,12 +40,12 @@ def set_modified_original_ignore_response():
def set_modified_with_trigger_text_response():
test_return_data = """<html>
<body>
Some NEW nice initial text</br>
Some NEW nice initial text<br>
<p>Which is across multiple lines</p>
</br>
<br>
Add to cart
<br/>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
@ -142,4 +142,4 @@ def test_trigger_functionality(client, live_server):
res = client.get(url_for("preview_page", uuid="first"))
# We should be able to see what we triggered on
assert b'<div class="triggered">Add to cart' in res.data
assert b'<div class="triggered">Add to cart' in res.data

@ -8,10 +8,10 @@ from . util import live_server_setup
def set_original_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
@ -72,7 +72,7 @@ def test_trigger_regex_functionality(client, live_server):
assert b'unviewed' not in res.data
with open("test-datastore/endpoint-content.txt", "w") as f:
f.write("regex test123<br/>\nsomething 123")
f.write("regex test123<br>\nsomething 123")
client.get(url_for("form_watch_checknow"), follow_redirects=True)
time.sleep(sleep_time_for_fetch_thread)
@ -81,4 +81,4 @@ def test_trigger_regex_functionality(client, live_server):
# Cleanup everything
res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True)
assert b'Deleted' in res.data
assert b'Deleted' in res.data

@ -8,10 +8,10 @@ from . util import live_server_setup
def set_original_ignore_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>

@ -12,10 +12,10 @@ def test_setup(live_server):
def set_original_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<div class="sametext">Some text thats the same</div>
<div class="changetext">Some text that will change</div>
</body>
@ -29,10 +29,10 @@ def set_original_response():
def set_modified_response():
test_return_data = """<html>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. THIS CHANGES AND SHOULDNT TRIGGER A CHANGE</br>
<br>
So let's see what happens. THIS CHANGES AND SHOULDNT TRIGGER A CHANGE<br>
<div class="sametext">Some text thats the same</div>
<div class="changetext">Some new text</div>
</body>

@ -9,10 +9,10 @@ def set_original_response():
test_return_data = """<html>
<head><title>head title</title></head>
<body>
Some initial text</br>
Some initial text<br>
<p>Which is across multiple lines</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
<span class="foobar-detection" style='display:none'></span>
</body>
</html>
@ -26,10 +26,10 @@ def set_modified_response():
test_return_data = """<html>
<head><title>modified head title</title></head>
<body>
Some initial text</br>
Some initial text<br>
<p>which has this one new line</p>
</br>
So let's see what happens. </br>
<br>
So let's see what happens. <br>
</body>
</html>
"""
@ -43,11 +43,11 @@ def set_more_modified_response():
test_return_data = """<html>
<head><title>modified head title</title></head>
<body>
Some initial text</br>
Some initial text<br>
<p>which has this one new line</p>
</br>
So let's see what happens. </br>
Ohh yeah awesome<br/>
<br>
So let's see what happens. <br>
Ohh yeah awesome<br>
</body>
</html>
"""

@ -65,7 +65,7 @@ class update_worker(threading.Thread):
if 'notification_urls' in n_object and n_object['notification_urls']:
# HTML needs linebreak, but MarkDown and Text can use a linefeed
if n_object['notification_format'] == 'HTML':
line_feed_sep = "</br>"
line_feed_sep = "<br>"
else:
line_feed_sep = "\n"

Loading…
Cancel
Save