commit a06cead: [Test] URL compose map

korgoth1 vladislav.stakhov at gmail.com
Tue Mar 3 22:15:15 UTC 2020


Author: korgoth1
Date: 2020-02-29 14:52:27 +0300
URL: https://github.com/rspamd/rspamd/commit/a06ceaddcb133c5aeb9f966cde59677e8ea41262 (refs/pull/3281/head)

[Test] URL compose map

---
 test/functional/cases/340_surbl.robot                    | 16 +++++++---------
 test/functional/configs/maps/url_compose_map.list        |  3 ++-
 .../configs/maps/url_compose_map_for_mails.list          |  1 +
 test/functional/configs/plugins.conf                     | 10 ++++++++++
 test/functional/configs/surbl.conf                       | 11 +++++++----
 test/functional/messages/url11.eml                       |  3 ++-
 test/functional/messages/url12.eml                       |  3 +++
 7 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/test/functional/cases/340_surbl.robot b/test/functional/cases/340_surbl.robot
index 092495d38..81e30de1d 100644
--- a/test/functional/cases/340_surbl.robot
+++ b/test/functional/cases/340_surbl.robot
@@ -104,21 +104,21 @@ WHITELIST
   Should Not Contain  ${result.stdout}  DBL_SPAM (
   Should Not Contain  ${result.stdout}  RSPAMD_URIBL_IMAGES (
 
-EMAILBL full adress & domain only
+EMAILBL full address & domain only
   ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/emailbltext.eml
   Should Contain  ${result.stdout}  RSPAMD_EMAILBL_FULL (
   Should Contain  ${result.stdout}  RSPAMD_EMAILBL_DOMAINONLY (
 
-EMAILBL full subdomain adress
+EMAILBL full subdomain address
   ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/emailbltext2.eml
   Should Contain  ${result.stdout}  RSPAMD_EMAILBL_FULL (
 
-EMAILBL full subdomain adress & domain only
+EMAILBL full subdomain address & domain only
   ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/emailbltext3.eml
   Should Contain  ${result.stdout}  RSPAMD_EMAILBL_DOMAINONLY (0.00)[baddomain.com:email]
   Should Contain  ${result.stdout}  RSPAMD_EMAILBL_FULL (0.00)[user.subdomain.baddomain.com:email]
 
-EMAILBL REPLY TO full adress
+EMAILBL REPLY TO full address
   ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/replyto.eml
   Should Contain  ${result.stdout}  RSPAMD_EMAILBL_FULL (
   Should Not Contain  ${result.stdout}  RSPAMD_EMAILBL_DOMAINONLY (
@@ -128,7 +128,7 @@ EMAILBL REPLY TO domain only
   Should Contain  ${result.stdout}  RSPAMD_EMAILBL_DOMAINONLY (
   Should Not Contain  ${result.stdout}  RSPAMD_EMAILBL_FULL (
 
-EMAILBL REPLY TO full subdomain adress
+EMAILBL REPLY TO full subdomain address
   ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/replytosubdomain.eml
   Should Contain  ${result.stdout}  RSPAMD_EMAILBL_FULL (
   Should Not Contain  ${result.stdout}  RSPAMD_EMAILBL_DOMAINONLY (
@@ -153,10 +153,8 @@ SURBL html entity&shy
 
 SURBL url compose map
   ${result} =  Scan Message With Rspamc  ${TESTDIR}/messages/url11.eml
-  Should Contain  ${result.stdout}  RSPAMD_URIBL
-  Should Contain  ${result.stdout}  DBL_SPAM
-  Should Not Contain  ${result.stdout}  DBL_PHISH
-  Should Not Contain  ${result.stdout}  URIBL_BLACK
+  Should Contain  ${result.stdout}  BAD_SUBDOMAIN (0.00)[very.dirty.sanchez.com:url]
+  Should Not Contain  ${result.stdout}  not.dirty.sanchez.com
 
 *** Keywords ***
 Surbl Setup
diff --git a/test/functional/configs/maps/url_compose_map.list b/test/functional/configs/maps/url_compose_map.list
index da65ffb0f..06868b288 100644
--- a/test/functional/configs/maps/url_compose_map.list
+++ b/test/functional/configs/maps/url_compose_map.list
@@ -1 +1,2 @@
-*.dirty.sanchez.com
\ No newline at end of file
+*.dirty.sanchez.com
+!not.dirty.sanchez.com
\ No newline at end of file
diff --git a/test/functional/configs/maps/url_compose_map_for_mails.list b/test/functional/configs/maps/url_compose_map_for_mails.list
new file mode 100644
index 000000000..2abdc5e32
--- /dev/null
+++ b/test/functional/configs/maps/url_compose_map_for_mails.list
@@ -0,0 +1 @@
+!very.clean.exclude.com
\ No newline at end of file
diff --git a/test/functional/configs/plugins.conf b/test/functional/configs/plugins.conf
index 17f004843..817b5e4db 100644
--- a/test/functional/configs/plugins.conf
+++ b/test/functional/configs/plugins.conf
@@ -670,6 +670,16 @@ options = {
           type = a;
           replies = ["127.0.0.2"];
         },
+        {
+          name = "clean.dirty.sanchez.com.test7.uribl";
+          type = a;
+          replies = ["127.0.0.2"];
+        },
+        {
+          name = "not.dirty.sanchez.com.test7.uribl";
+          type = a;
+          replies = ["127.0.0.2"];
+        },
         # TODO: add IPv6 tests
         ];
   }
diff --git a/test/functional/configs/surbl.conf b/test/functional/configs/surbl.conf
index 764d5edd8..a2565784e 100644
--- a/test/functional/configs/surbl.conf
+++ b/test/functional/configs/surbl.conf
@@ -2,9 +2,6 @@ surbl {
     "whitelist" = [
     "rspamd-test.com"
   ];
-    "url_compose_map" = [
-    "${TESTDIR}/configs/maps/url_compose_map.list",
-    ];
   rules {
     "RSPAMD_URIBL" {
       suffix = "test.uribl";
@@ -69,9 +66,15 @@ EOD;
     }
     "BAD_SUBDOMAIN" {
       suffix = "test7.uribl";
+      url_compose_map = "${TESTDIR}/configs/maps/url_compose_map.list";
       check_dkim = true;
       check_emails = false;
-      images = true;
+    }
+    "BAD_SUBDOMAIN_IN_MAIL" {
+      suffix = "test8.uribl";
+      url_compose_map = "${TESTDIR}/configs/maps/url_compose_map_for_mails.list";
+      check_dkim = true;
+      check_emails = true;
     }
   }
 }
diff --git a/test/functional/messages/url11.eml b/test/functional/messages/url11.eml
index a757d0177..82ddbf77d 100644
--- a/test/functional/messages/url11.eml
+++ b/test/functional/messages/url11.eml
@@ -1,3 +1,4 @@
 Content-Type: text/plain
 
-http://very.dirty.sanchez.com
+http://clean.dirty.sanchez.com
+http://not.dirty.sanchez.com
\ No newline at end of file
diff --git a/test/functional/messages/url12.eml b/test/functional/messages/url12.eml
new file mode 100644
index 000000000..b8467f680
--- /dev/null
+++ b/test/functional/messages/url12.eml
@@ -0,0 +1,3 @@
+Content-Type: text/plain
+
+http://not.dirty.sanchez.com
\ No newline at end of file


More information about the Commits mailing list