diff --git a/changedetectionio/tests/test_restock_itemprop.py b/changedetectionio/tests/test_restock_itemprop.py index b7d5c7695..c97f48527 100644 --- a/changedetectionio/tests/test_restock_itemprop.py +++ b/changedetectionio/tests/test_restock_itemprop.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 -import re import os import time from flask import url_for -from .util import live_server_setup, wait_for_all_checks, wait_for_notification_endpoint_output, extract_UUID_from_client, delete_all_watches +from .util import live_server_setup, wait_for_all_checks, wait_for_notification_endpoint_output, extract_UUID_from_client, delete_all_watches, \ + get_form_field from ..notification import default_notification_format instock_props = [ @@ -340,9 +340,8 @@ def test_itemprop_percent_threshold(client, live_server, measure_memory_usage, d # And back again live_server.app.config['DATASTORE'].data['watching'][uuid]['processor'] = 'restock_diff' res = client.get(url_for("ui.ui_edit.edit_page", uuid=uuid)) - # Don't assert the input type: WTForms 3.3 renders FloatField as type="number", older versions as type="text" - threshold_input = re.search(rb']*name="processor_config_restock_diff-price_change_threshold_percent"[^>]*>', res.data) - assert threshold_input and b'value="5.05"' in threshold_input.group(0) + threshold_input = get_form_field(res.data, 'processor_config_restock_diff-price_change_threshold_percent') + assert threshold_input and threshold_input['value'] == '5.05' delete_all_watches(client) diff --git a/changedetectionio/tests/util.py b/changedetectionio/tests/util.py index 93bb52d0c..b0f9c9027 100644 --- a/changedetectionio/tests/util.py +++ b/changedetectionio/tests/util.py @@ -159,6 +159,17 @@ def extract_UUID_from_client(client): uuid = m.group(1) return uuid.strip() + +def get_form_field(html, name): + """Return the ,