diff --git a/changedetectionio/tests/test_api.py b/changedetectionio/tests/test_api.py index 5cbce276..19f1d0f6 100644 --- a/changedetectionio/tests/test_api.py +++ b/changedetectionio/tests/test_api.py @@ -629,7 +629,8 @@ def test_api_url_validation(client, live_server, measure_memory_usage, datastore data=json.dumps({"url": None}), ) assert res.status_code == 400, "Updating watch URL to null should fail" - assert b'URL cannot be null' in res.data + # Accept either OpenAPI validation error or our custom validation error + assert b'URL cannot be null' in res.data or b'OpenAPI validation failed' in res.data or b'validation error' in res.data.lower() # Test 8: UPDATE to empty string URL should fail res = client.put( @@ -638,7 +639,8 @@ def test_api_url_validation(client, live_server, measure_memory_usage, datastore data=json.dumps({"url": ""}), ) assert res.status_code == 400, "Updating watch URL to empty string should fail" - assert b'URL cannot be empty' in res.data + # Accept either our custom validation error or OpenAPI/schema validation error + assert b'URL cannot be empty' in res.data or b'OpenAPI validation' in res.data or b'Invalid or unsupported URL' in res.data # Test 9: UPDATE to whitespace-only URL should fail res = client.put( @@ -647,7 +649,8 @@ def test_api_url_validation(client, live_server, measure_memory_usage, datastore data=json.dumps({"url": " \t\n "}), ) assert res.status_code == 400, "Updating watch URL to whitespace should fail" - assert b'URL cannot be empty' in res.data + # Accept either our custom validation error or generic validation error + assert b'URL cannot be empty' in res.data or b'Invalid or unsupported URL' in res.data or b'validation' in res.data.lower() # Test 10: UPDATE to invalid protocol should fail (javascript:) res = client.put(