]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] Fix statistics tests
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 10 Jul 2019 12:11:19 +0000 (13:11 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 10 Jul 2019 12:11:19 +0000 (13:11 +0100)
test/functional/cases/110_statistics/lib.robot

index 619f355d07e3d90839b066de8be019ec742e99ea..c20c0f651fc4a2456ed17337c48b7afca6622aeb 100644 (file)
@@ -5,7 +5,8 @@ Variables       ${TESTDIR}/lib/vars.py
 
 *** Variables ***
 ${CONFIG}       ${TESTDIR}/configs/stats.conf
-${MESSAGE}      ${TESTDIR}/messages/spam_message.eml
+${MESSAGE_SPAM}      ${TESTDIR}/messages/spam_message.eml
+${MESSAGE_HAM}      ${TESTDIR}/messages/ham.eml
 ${REDIS_SCOPE}  Suite
 ${REDIS_SERVER}  ${EMPTY}
 ${RSPAMD_SCOPE}  Suite
@@ -14,7 +15,7 @@ ${STATS_KEY}    ${EMPTY}
 
 *** Keywords ***
 Broken Learn Test
-  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_spam  ${MESSAGE}
+  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_spam  ${MESSAGE_SPAM}
   Check Rspamc  ${result}  Unknown statistics error
 
 Empty Part Test
@@ -26,17 +27,20 @@ Empty Part Test
 
 Learn Test
   Set Suite Variable  ${RSPAMD_STATS_LEARNTEST}  0
-  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_spam  ${MESSAGE}
+  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_spam  ${MESSAGE_SPAM}
+  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_ham  ${MESSAGE_HAM}
   Check Rspamc  ${result}
-  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  ${result} =  Scan Message With Rspamc  ${MESSAGE_SPAM}
   Check Rspamc  ${result}  BAYES_SPAM
+  ${result} =  Scan Message With Rspamc  ${MESSAGE_HAM}
+  Check Rspamc  ${result}  BAYES_HAM
   Set Suite Variable  ${RSPAMD_STATS_LEARNTEST}  1
 
 Relearn Test
   Run Keyword If  ${RSPAMD_STATS_LEARNTEST} == 0  Fail  "Learn test was not run"
-  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_ham  ${MESSAGE}
+  ${result} =  Run Rspamc  -h  ${LOCAL_ADDR}:${PORT_CONTROLLER}  learn_ham  ${MESSAGE_SPAM}
   Check Rspamc  ${result}
-  ${result} =  Scan Message With Rspamc  ${MESSAGE}
+  ${result} =  Scan Message With Rspamc  ${MESSAGE_SPAM}
   ${pass} =  Run Keyword And Return Status  Check Rspamc  ${result}  BAYES_HAM
   Run Keyword If  ${pass}  Pass Execution  What Me Worry
   Should Not Contain  ${result.stdout}  BAYES_SPAM