]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Add more tests for multimap module
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 28 Jul 2016 15:20:18 +0000 (16:20 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 28 Jul 2016 16:20:50 +0000 (17:20 +0100)
test/functional/cases/102_maps.robot
test/functional/configs/maps.conf
test/functional/configs/maps/domains.list [new file with mode: 0644]
test/functional/configs/maps/ip.list [new file with mode: 0644]
test/functional/configs/maps/regexp.list [new file with mode: 0644]

index 31bf8fc66ae211b878d85ef18114eec1fa1b0086..0f89a6ff82e32e99d84b33f848d1175f75147682 100644 (file)
@@ -17,4 +17,46 @@ MAP - DNSBL HIT
 
 MAP - DNSBL MISS
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  127.0.0.1
-  Check Rspamc  ${result}  DNSBL_MAP  inverse=1  rc_nocheck=1
\ No newline at end of file
+  Check Rspamc  ${result}  DNSBL_MAP  inverse=1  rc_nocheck=1
+
+MAP - IP HIT
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  127.0.0.1
+  Check Rspamc  ${result}  IP_MAP
+
+MAP - IP MISS
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  127.0.0.2
+  Check Rspamc  ${result}  IP_MAP  inverse=1  rc_nocheck=1
+
+MAP - IP MASK
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  10.1.0.10
+   Check Rspamc  ${result}  IP_MAP
+
+MAP - IP MASK MISS
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  11.1.0.10
+  Check Rspamc  ${result}  IP_MAP  inverse=1  rc_nocheck=1
+
+MAP - IP V6
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  ::1
+   Check Rspamc  ${result}  IP_MAP
+
+MAP - IP V6 MISS
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -i  fe80::1
+  Check Rspamc  ${result}  IP_MAP  inverse=1  rc_nocheck=1
+
+MAP - FROM
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  user@example.com
+   Check Rspamc  ${result}  FROM_MAP
+
+MAP - FROM MISS
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  user@other.com
+  Check Rspamc  ${result}  FROM_MAP  inverse=1  rc_nocheck=1
+
+MAP - FROM REGEXP
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  user123@test.com
+   Check Rspamc  ${result}  REGEXP_MAP
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  somebody@exAmplE.com
+   Check Rspamc  ${result}  REGEXP_MAP
+
+MAP - FROM REGEXP MISS
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --from  user@other.org
+  Check Rspamc  ${result}  REGEXP_MAP  inverse=1  rc_nocheck=1
\ No newline at end of file
index bb3fad0d545672e7cf3cca2243e28363b54951fa..df568c22dbf54fe1ffb64394d5be90f8ad94a69a 100644 (file)
@@ -33,4 +33,19 @@ multimap {
     type = "dnsbl";
     map = "rspamd.com";
   }
+  IP_MAP {
+    type = "ip";
+    map = "${TESTDIR}/configs/maps/ip.list";
+  }
+  FROM_MAP {
+    type = "from";
+    filter = "email:domain";
+    map = "${TESTDIR}/configs/maps/domains.list";
+  }
+  REGEXP_MAP {
+    type = "from";
+    filter = "email:addr";
+    regexp = true;
+    map = "${TESTDIR}/configs/maps/regexp.list";
+  }
 }
diff --git a/test/functional/configs/maps/domains.list b/test/functional/configs/maps/domains.list
new file mode 100644 (file)
index 0000000..2d8e638
--- /dev/null
@@ -0,0 +1,2 @@
+example.com
+#other.com
\ No newline at end of file
diff --git a/test/functional/configs/maps/ip.list b/test/functional/configs/maps/ip.list
new file mode 100644 (file)
index 0000000..fc3dbf1
--- /dev/null
@@ -0,0 +1,4 @@
+127.0.0.1
+#127.0.0.2
+10.0.0.0/8
+[::1]/64
\ No newline at end of file
diff --git a/test/functional/configs/maps/regexp.list b/test/functional/configs/maps/regexp.list
new file mode 100644 (file)
index 0000000..0f3ef27
--- /dev/null
@@ -0,0 +1,2 @@
+/^.*@example.com/i
+/^user.*@.*com/i