summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-05-26 14:04:05 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-05-26 14:04:05 +0200
commite7c48b947fdba28117516a19a5af622f6f484690 (patch)
tree85cca7488f3e4b0f68c77530f0fcb93c8bb4b9ba /test
parentff0d6e33c17a83211ccac3fe5ec9617617b388f4 (diff)
downloadrspamd-e7c48b947fdba28117516a19a5af622f6f484690.tar.gz
rspamd-e7c48b947fdba28117516a19a5af622f6f484690.zip
[Test] Phishing
Diffstat (limited to 'test')
-rw-r--r--test/functional/cases/114_phishing.robot33
-rw-r--r--test/functional/configs/maps/strict.phishing1
-rw-r--r--test/functional/configs/maps/stricter.phishing1
-rw-r--r--test/functional/configs/phishing.conf7
-rw-r--r--test/functional/messages/phishing1.eml3
-rw-r--r--test/functional/messages/phishing2.eml3
-rw-r--r--test/functional/messages/phishing3.eml3
7 files changed, 51 insertions, 0 deletions
diff --git a/test/functional/cases/114_phishing.robot b/test/functional/cases/114_phishing.robot
new file mode 100644
index 000000000..dd2d3c806
--- /dev/null
+++ b/test/functional/cases/114_phishing.robot
@@ -0,0 +1,33 @@
+*** Settings ***
+Suite Setup Phishing Setup
+Suite Teardown Simple Teardown
+Library ${TESTDIR}/lib/rspamd.py
+Resource ${TESTDIR}/lib/rspamd.robot
+Variables ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG} ${TESTDIR}/configs/plugins.conf
+${MESSAGE1} ${TESTDIR}/messages/phishing1.eml
+${MESSAGE2} ${TESTDIR}/messages/phishing2.eml
+${MESSAGE3} ${TESTDIR}/messages/phishing3.eml
+${RSPAMD_SCOPE} Suite
+${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat
+
+*** Test Cases ***
+TEST PHISHING
+ ${result} = Scan Message With Rspamc ${MESSAGE1}
+ Check Rspamc ${result} ${SPACE}PHISHING
+
+TEST PHISHING STRICT ONE
+ ${result} = Scan Message With Rspamc ${MESSAGE2}
+ Check Rspamc ${result} STRICT_PHISHING
+
+TEST PHISHING STRICT TWO
+ ${result} = Scan Message With Rspamc ${MESSAGE3}
+ Check Rspamc ${result} STRICTER_PHISHING
+
+*** Keywords ***
+Phishing Setup
+ ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/phishing.conf
+ Set Suite Variable ${PLUGIN_CONFIG}
+ Generic Setup PLUGIN_CONFIG
diff --git a/test/functional/configs/maps/strict.phishing b/test/functional/configs/maps/strict.phishing
new file mode 100644
index 000000000..af2de57b1
--- /dev/null
+++ b/test/functional/configs/maps/strict.phishing
@@ -0,0 +1 @@
+myspace.com
diff --git a/test/functional/configs/maps/stricter.phishing b/test/functional/configs/maps/stricter.phishing
new file mode 100644
index 000000000..a1240eaff
--- /dev/null
+++ b/test/functional/configs/maps/stricter.phishing
@@ -0,0 +1 @@
+bank.com
diff --git a/test/functional/configs/phishing.conf b/test/functional/configs/phishing.conf
new file mode 100644
index 000000000..3ea53a0d1
--- /dev/null
+++ b/test/functional/configs/phishing.conf
@@ -0,0 +1,7 @@
+phishing {
+ symbol = "PHISHING";
+ strict_domains = [
+ "${TESTDIR}/configs/maps/strict.phishing:STRICT_PHISHING",
+ "${TESTDIR}/configs/maps/stricter.phishing:STRICTER_PHISHING"
+ ];
+}
diff --git a/test/functional/messages/phishing1.eml b/test/functional/messages/phishing1.eml
new file mode 100644
index 000000000..d168068b4
--- /dev/null
+++ b/test/functional/messages/phishing1.eml
@@ -0,0 +1,3 @@
+Content-type: text/html
+
+lol <a href="http://www.example.net">http://www.cnn.com</a>
diff --git a/test/functional/messages/phishing2.eml b/test/functional/messages/phishing2.eml
new file mode 100644
index 000000000..575dd0b87
--- /dev/null
+++ b/test/functional/messages/phishing2.eml
@@ -0,0 +1,3 @@
+Content-type: text/html
+
+lol <a href="http://www.example.net">http://www.myspace.com</a>
diff --git a/test/functional/messages/phishing3.eml b/test/functional/messages/phishing3.eml
new file mode 100644
index 000000000..8ec9af550
--- /dev/null
+++ b/test/functional/messages/phishing3.eml
@@ -0,0 +1,3 @@
+Content-type: text/html
+
+lol <a href="http://www.example.net">http://www.bank.com</a>