From 2a09f217228611e593c58f122ddc71da7fa21a18 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sat, 11 Apr 2026 04:57:05 +0200 Subject: [PATCH] update tests and api spec --- changedetectionio/tests/test_api.py | 6 ++++++ docs/api-spec.yaml | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/changedetectionio/tests/test_api.py b/changedetectionio/tests/test_api.py index b40e47a1b..fae2b2a13 100644 --- a/changedetectionio/tests/test_api.py +++ b/changedetectionio/tests/test_api.py @@ -374,6 +374,9 @@ def test_roundtrip_API(client, live_server, measure_memory_usage, datastore_path watch['last_changed'] = 454444444444 watch['date_created'] = 454444444444 + # Exercise the new extract_lines_containing field + watch['extract_lines_containing'] = ['celsius', 'temperature'] + # HTTP PUT ( UPDATE an existing watch ) res = client.put( url_for("watch", uuid=uuid), @@ -397,6 +400,9 @@ def test_roundtrip_API(client, live_server, measure_memory_usage, datastore_path assert date_created != 454444444444 assert date_created != "454444444444" + assert res.json.get('extract_lines_containing') == ['celsius', 'temperature'], \ + "extract_lines_containing should be persisted and returned via API" + def test_access_denied(client, live_server, measure_memory_usage, datastore_path): # `config_api_token_enabled` Should be On by default diff --git a/docs/api-spec.yaml b/docs/api-spec.yaml index 2dd9d5555..06493b757 100644 --- a/docs/api-spec.yaml +++ b/docs/api-spec.yaml @@ -460,6 +460,13 @@ components: maxLength: 5000 maxItems: 100 description: Text that should NOT be present (triggers alert if found) + extract_lines_containing: + type: array + items: + type: string + maxLength: 5000 + maxItems: 100 + description: Keep only lines containing these substrings (plain text, case-insensitive) — simpler alternative to regex extract_text: type: array items: