Browse Source

[Test] RBL: test more URL extraction scenarios

pull/5310/head
Andrew Lewis 9 months ago
parent
commit
2af61e6841
  1. 26
      test/functional/cases/001_merged/300_rbl.robot
  2. 25
      test/functional/configs/merged-local.conf
  3. 12
      test/functional/configs/merged-override.conf
  4. 9
      test/functional/lib/rspamd.robot

26
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

25
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";

12
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;

9
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}

Loading…
Cancel
Save