From: Andrew Lewis Date: Mon, 20 Jan 2025 11:22:43 +0000 (+0200) Subject: [Test] RBL: test more URL extraction scenarios X-Git-Tag: 3.11.1~36^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2af61e68417778af0aaabe9063bc0931d63c174e;p=thirdparty%2Frspamd.git [Test] RBL: test more URL extraction scenarios --- diff --git a/test/functional/cases/001_merged/300_rbl.robot b/test/functional/cases/001_merged/300_rbl.robot index 8b19fae068..f71c18f570 100644 --- a/test/functional/cases/001_merged/300_rbl.robot +++ b/test/functional/cases/001_merged/300_rbl.robot @@ -96,3 +96,29 @@ NUMERIC URLS WITH EVERYTHING ... IP=127.0.0.1 ... Settings={symbols_enabled = [URIBL_NUMERIC_EVERYTHING]} Expect Symbol With Exact Options URIBL_NUMERIC_EVERYTHING 12.11.10.9:url 4.3.2.1:url 8.7.6.5:url + +NONNUMERIC URLS VANILLA + Scan File ${RSPAMD_TESTDIR}/messages/numeric_urls.eml + ... Settings={symbols_enabled = [URIBL_NONNUMERIC_VANILLA]} + # Content + Do Not Expect Symbol With Option URIBL_NONNUMERIC_VANILLA example.com:url + # Image + Do Not Expect Symbol With Option URIBL_NONNUMERIC_VANILLA judo.za.org:url + # URL + Expect Symbol With Option URIBL_NONNUMERIC_VANILLA example.org:url + # Numeric + Do Not Expect Symbol With Option URIBL_NONNUMERIC_VANILLA 4.3.2.1:url + Do Not Expect Symbol With Option URIBL_NONNUMERIC_VANILLA 1.2.3.4:url + +NONNUMERIC URLS WITH EVERYTHING + Scan File ${RSPAMD_TESTDIR}/messages/numeric_urls.eml + ... Settings={symbols_enabled = [URIBL_NONNUMERIC_EVERYTHING]} + # Content + Expect Symbol With Option URIBL_NONNUMERIC_EVERYTHING example.com:url + # Image + Expect Symbol With Option URIBL_NONNUMERIC_EVERYTHING judo.za.org:url + # URL + Expect Symbol With Option URIBL_NONNUMERIC_EVERYTHING example.org:url + # Numeric + Do Not Expect Symbol With Option URIBL_NONNUMERIC_EVERYTHING 4.3.2.1:url + Do Not Expect Symbol With Option URIBL_NONNUMERIC_EVERYTHING 1.2.3.4:url diff --git a/test/functional/configs/merged-local.conf b/test/functional/configs/merged-local.conf index 2aef274c21..f70c4f8650 100644 --- a/test/functional/configs/merged-local.conf +++ b/test/functional/configs/merged-local.conf @@ -905,6 +905,31 @@ options = { type = a; replies = ["127.0.0.2"]; }, + { + name = "1.2.3.4.test10.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "4.3.2.1.test10.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "judo.za.org.test10.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "example.com.test10.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "example.org.test10.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, { name = "site.resolveme", type = "a"; diff --git a/test/functional/configs/merged-override.conf b/test/functional/configs/merged-override.conf index 32d3df7fee..344e307864 100644 --- a/test/functional/configs/merged-override.conf +++ b/test/functional/configs/merged-override.conf @@ -327,6 +327,18 @@ rbl { URIBL_NUMERIC_CONTENT = "*.*.*.*"; } } + URIBL_NONNUMERIC_VANILLA { + checks = ["urls"]; + rbl = "test10.uribl"; + exclude_local = false; + no_ip = true; + } + URIBL_NONNUMERIC_EVERYTHING { + checks = ["urls", "content_urls", "images"]; + rbl = "test10.uribl"; + exclude_local = false; + no_ip = true; + } URIBL_NUMERIC_EVERYTHING { checks = ["numeric_urls"]; images = true; diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index 68bcb66fb6..9c30a97dba 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -87,6 +87,15 @@ Do Not Expect Symbol Dictionary Should Not Contain Key ${SCAN_RESULT}[symbols] ${symbol} ... msg=Symbol ${symbol} was not expected to be found in result +Do Not Expect Symbol With Option + [Arguments] ${symbol} ${option} + IF '${symbol}' not in ${SCAN_RESULT}[symbols] + RETURN + END + ${have_options} = Convert To List ${SCAN_RESULT}[symbols][${symbol}][options] + Should Not Contain ${have_options} ${option} + ... msg="Options for symbol ${symbol} ${SCAN_RESULT}[symbols][${symbol}][options] doesn't contain ${option}" + Do Not Expect Symbols [Arguments] @{symbols} FOR ${symbol} IN @{symbols}