commit b6f7ade: [Test] Add more tests for the passwords checking logic

Vsevolod Stakhov vsevolod at rspamd.com
Tue Oct 11 07:42:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-10-11 08:35:56 +0100
URL: https://github.com/rspamd/rspamd/commit/b6f7ade3b6613750cfbe33bbd22a97dc75601ee8 (HEAD -> master)

[Test] Add more tests for the passwords checking logic

---
 test/functional/cases/103_password.robot | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/test/functional/cases/103_password.robot b/test/functional/cases/103_password.robot
index a8dade884..2237a6a31 100644
--- a/test/functional/cases/103_password.robot
+++ b/test/functional/cases/103_password.robot
@@ -9,47 +9,63 @@ ${CONFIG}                  ${RSPAMD_TESTDIR}/configs/password.conf
 ${CONTROLLER_ERRORS}       False
 ${RSPAMD_CATENA_PASSWORD}  "$2$xu1581gidj5cyp4yjgo68qbj6jz1j8o3$j9yg4k58jy3fj8suijxx9d7pea6a6obtufq9kfenosyq8erm87ky"
 ${RSPAMD_PBKDF_PASSWORD}   "$1$rhzzahtm8a5homdhh7z4qiiy7j8pzp4u$k5toro136brshjjuy9t39r785td69qodmd39qzygxuyehn9tqauy"
+${RSPAMD_ENABLE_CATENA_PASSWORD}   "$2$irotou88u89r1gj53pqnom96qo36hgkn$d4dt3466db7ccqx96k18yz9b1brx8hmk3b4w6erf4oqpmf9sag6y"
 ${RSPAMD_SCOPE}            Test
 
 *** Test Cases ***
 PASSWORD - PBKDF
-  [Setup]  Password Setup  ${RSPAMD_PBKDF_PASSWORD}
+  [Setup]  Password Setup  ${RSPAMD_PBKDF_PASSWORD}  ${RSPAMD_ENABLE_CATENA_PASSWORD}
   ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  nq1  stat
   Check Rspamc  ${result}  Messages scanned:
 
 PASSWORD - PBKDF WRONG
-  [Setup]  Password Setup  ${RSPAMD_PBKDF_PASSWORD}
+  [Setup]  Password Setup  ${RSPAMD_PBKDF_PASSWORD}  ${RSPAMD_ENABLE_CATENA_PASSWORD}
   ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  q1q1  stat
   Should Be Equal As Integers  ${result.rc}  1
 
 PASSWORD - CATENA
-  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}
+  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}  ${RSPAMD_ENABLE_CATENA_PASSWORD}
   ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  nq1  stat
   Check Rspamc  ${result}  Messages scanned:
 
 PASSWORD - CATENA WRONG
-  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}
+  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}  ${RSPAMD_ENABLE_CATENA_PASSWORD}
   ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  q  stat
   Should Be Equal As Integers  ${result.rc}  1
 
 PASSWORD - ENABLE
-  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}
+  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}  ${RSPAMD_ENABLE_CATENA_PASSWORD}
   ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  nq2  stat_reset
   Check Rspamc  ${result}  Messages scanned:
 
 PASSWORD - ENABLE WITH NORMAL
-  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}
+  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}  ${RSPAMD_ENABLE_CATENA_PASSWORD}
   ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  nq1  stat_reset
   Should Be Equal As Integers  ${result.rc}  1
 
 PASSWORD - ENABLE INCORRECT
-  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}
+  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}  ${RSPAMD_ENABLE_CATENA_PASSWORD}
   ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  q2q2  stat_reset
   Should Be Equal As Integers  ${result.rc}  1
 
+PASSWORD - ENABLE EQUAL TO NORMAL PRIV COMMAND
+  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}  ${RSPAMD_CATENA_PASSWORD}
+  ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  nq1  stat_reset
+  Check Rspamc  ${result}  Messages scanned:
+
+PASSWORD - ENABLE EQUAL TO NORMAL NON PRIV COMMAND
+  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}  ${RSPAMD_CATENA_PASSWORD}
+  ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  nq1  stat
+  Check Rspamc  ${result}  Messages scanned:
+
+PASSWORD - ENABLE EQUAL TO NORMAL WRONG PASSWORD
+  [Setup]  Password Setup  ${RSPAMD_CATENA_PASSWORD}  ${RSPAMD_CATENA_PASSWORD}
+  ${result} =  Run Rspamc  -h  ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_CONTROLLER}  -P  nq2  stat
+  Should Be Equal As Integers  ${result.rc}  1
+
 *** Keywords ***
 Password Setup
-  [Arguments]  ${RSPAMD_PASSWORD}  ${RSPAMD_ENABLE_PASSWORD}=nq2
+  [Arguments]  ${RSPAMD_PASSWORD}  ${RSPAMD_ENABLE_PASSWORD}
   Set Test Variable  ${RSPAMD_PASSWORD}
   Set Test Variable  ${RSPAMD_ENABLE_PASSWORD}
   Rspamd Setup


More information about the Commits mailing list