summaryrefslogtreecommitdiffstats
path: root/test/functional/cases
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2017-03-06 16:45:21 +0200
committerAndrew Lewis <nerf@judo.za.org>2017-03-06 16:45:21 +0200
commitb88b679dd797b92ad7cfaa365c130ebd8b2b0dd2 (patch)
treefecb5291686f00d66b5d3192e2f651d331dd21d2 /test/functional/cases
parentefbf2c75c52473088c310dbd5281bfbd0d53d173 (diff)
downloadrspamd-b88b679dd797b92ad7cfaa365c130ebd8b2b0dd2.tar.gz
rspamd-b88b679dd797b92ad7cfaa365c130ebd8b2b0dd2.zip
[Test] Some tests for antivirus module
Diffstat (limited to 'test/functional/cases')
-rw-r--r--test/functional/cases/160_antivirus.robot80
1 files changed, 80 insertions, 0 deletions
diff --git a/test/functional/cases/160_antivirus.robot b/test/functional/cases/160_antivirus.robot
new file mode 100644
index 000000000..f3604b2fe
--- /dev/null
+++ b/test/functional/cases/160_antivirus.robot
@@ -0,0 +1,80 @@
+*** Settings ***
+Suite Setup Antivirus Setup
+Suite Teardown Antivirus Teardown
+Library Process
+Library ${TESTDIR}/lib/rspamd.py
+Resource ${TESTDIR}/lib/rspamd.robot
+Variables ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG} ${TESTDIR}/configs/plugins.conf
+${MESSAGE} ${TESTDIR}/messages/spam_message.eml
+${MESSAGE2} ${TESTDIR}/messages/freemail.eml
+${REDIS_SCOPE} Suite
+${RSPAMD_SCOPE} Suite
+${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
+
+*** Test Cases ***
+CLAMAV MISS
+ Run Dummy Clam ${PORT_CLAM}
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} CLAM_VIRUS inverse=1
+
+CLAMAV HIT
+ Run Dummy Clam ${PORT_CLAM} 1
+ ${result} = Scan Message With Rspamc ${MESSAGE2}
+ Check Rspamc ${result} CLAM_VIRUS (1.00)[Eicar-Test-Signature]
+ Should Not Contain ${result.stdout} FPROT_
+
+CLAMAV CACHE HIT
+ ${result} = Scan Message With Rspamc ${MESSAGE2}
+ Check Rspamc ${result} CLAM_VIRUS (1.00)[Eicar-Test-Signature]
+ Should Not Contain ${result.stdout} FPROT_
+
+CLAMAV CACHE MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} CLAM_VIRUS inverse=1
+ Should Not Contain ${result.stdout} FPROT_
+
+FPROT MISS
+ Run Dummy Fprot ${PORT_FPROT}
+ ${result} = Scan Message With Rspamc ${MESSAGE2}
+ Check Rspamc ${result} FPROT_VIRUS inverse=1
+ Should Not Contain ${result.stdout} FPROT_EICAR
+
+FPROT HIT - PATTERN
+ Run Dummy Fprot ${PORT_FPROT} 1
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} FPROT_EICAR (1.00)[EICAR_Test_File]
+ Should Not Contain ${result.stdout} CLAMAV_VIRUS
+
+FPROT CACHE HIT
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} FPROT_EICAR (1.00)[EICAR_Test_File]
+ Should Not Contain ${result.stdout} CLAMAV_VIRUS
+
+FPROT CACHE MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE2}
+ Check Rspamc ${result} FPROT_ inverse=1
+
+*** Keywords ***
+Antivirus Setup
+ ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/antivirus.conf
+ Set Suite Variable ${PLUGIN_CONFIG}
+ Generic Setup PLUGIN_CONFIG
+ Run Redis
+
+Antivirus Teardown
+ Normal Teardown
+ Shutdown Process With Children ${REDIS_PID}
+ Wait For Port ${SOCK_STREAM} ${LOCAL_ADDR} ${REDIS_PORT}
+
+Run Dummy Clam
+ [Arguments] ${port} ${found}=
+ Wait For Port ${SOCK_STREAM} ${LOCAL_ADDR} ${port}
+ ${result} = Start Process ${TESTDIR}/util/dummy_clam.py ${port} ${found}
+
+Run Dummy Fprot
+ [Arguments] ${port} ${found}=
+ Wait For Port ${SOCK_STREAM} ${LOCAL_ADDR} ${port}
+ ${result} = Start Process ${TESTDIR}/util/dummy_fprot.py ${port} ${found}