From cb3a3c90501237a05f90d297ffb0a118e7f5eb66 Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Thu, 28 Jul 2016 20:33:26 +0100 Subject: [PATCH] [Test] Some minor fixes & improvements for tests - Also machine-format test data again --- test/functional/cases/102_maps.robot | 24 ++++++++++++------------ test/functional/cases/103_password.robot | 21 ++++++++++----------- test/functional/lib/rspamd.robot | 2 ++ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/test/functional/cases/102_maps.robot b/test/functional/cases/102_maps.robot index aecc61b5c..e391af99c 100644 --- a/test/functional/cases/102_maps.robot +++ b/test/functional/cases/102_maps.robot @@ -17,7 +17,7 @@ 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 + Check Rspamc ${result} DNSBL_MAP inverse=1 rc_noinverse=1 MAP - IP HIT ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1 @@ -25,41 +25,41 @@ MAP - IP HIT MAP - IP MISS ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.2 - Check Rspamc ${result} IP_MAP inverse=1 rc_nocheck=1 + Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1 MAP - IP MASK ${result} = Scan Message With Rspamc ${MESSAGE} -i 10.1.0.10 - Check Rspamc ${result} IP_MAP + 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 + Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1 MAP - IP V6 ${result} = Scan Message With Rspamc ${MESSAGE} -i ::1 - Check Rspamc ${result} IP_MAP + 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 + Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1 MAP - FROM ${result} = Scan Message With Rspamc ${MESSAGE} --from user@example.com - Check Rspamc ${result} FROM_MAP + 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 + Check Rspamc ${result} FROM_MAP inverse=1 rc_noinverse=1 MAP - FROM REGEXP ${result} = Scan Message With Rspamc ${MESSAGE} --from user123@test.com - Check Rspamc ${result} REGEXP_MAP + Check Rspamc ${result} REGEXP_MAP ${result} = Scan Message With Rspamc ${MESSAGE} --from somebody@exAmplE.com - Check Rspamc ${result} REGEXP_MAP + 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 + Check Rspamc ${result} REGEXP_MAP inverse=1 rc_noinverse=1 MAP - DEPENDS HIT ${result} = Scan Message With Rspamc ${MESSAGE} -i 147.243.1.47 --from user123@microsoft.com @@ -87,4 +87,4 @@ MAP - MULSYM SYMBOL MISS MAP - MULSYM SYMBOL + SCORE ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user5@example.com - Check Rspamc ${result} SYM1 (-10.0 \ No newline at end of file + Check Rspamc ${result} SYM1 (-10.0 diff --git a/test/functional/cases/103_password.robot b/test/functional/cases/103_password.robot index 93e55d683..3853572d4 100644 --- a/test/functional/cases/103_password.robot +++ b/test/functional/cases/103_password.robot @@ -1,5 +1,5 @@ *** Settings *** -Test Teardown Generic Teardown +Test Teardown Generic Teardown Library ${TESTDIR}/lib/rspamd.py Resource ${TESTDIR}/lib/rspamd.robot Variables ${TESTDIR}/lib/vars.py @@ -7,49 +7,48 @@ Variables ${TESTDIR}/lib/vars.py *** Variables *** ${CONFIG} ${TESTDIR}/configs/password.conf ${RSPAMD_SCOPE} Test -${PBKDF_PASSWORD} "$1$nxnwqu5t6ruqfzb4h7bs47ogmdk9sb74$c8mbmcfyd6aic1sm48qzxuzkw4nhx6te6h7owgxz63bcd7fqu1dy" +${PBKDF_PASSWORD} "$1$nxnwqu5t6ruqfzb4h7bs47ogmdk9sb74$c8mbmcfyd6aic1sm48qzxuzkw4nhx6te6h7owgxz63bcd7fqu1dy" ${CATENA_PASSWORD} "$2$9dydyukfndmi8zzp7rbdsu43y7a3iucg$1nketaa9pjqwwzzjxogcrniphw4y5fanixudpwzza85tcb56yzub" *** Test Cases *** PASSWORD - PBKDF [Setup] Password Setup ${PBKDF_PASSWORD} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q1 stat - Should Contain ${result.stdout} Messages scanned: + Check Rspamc ${result} Messages scanned: PASSWORD - PBKDF WRONG [Setup] Password Setup ${PBKDF_PASSWORD} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q1q1 stat - Should Contain ${result.stdout} Unauthorized rc_nocheck=1 + Check Rspamc ${result} Unauthorized PASSWORD - CATENA [Setup] Password Setup ${CATENA_PASSWORD} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q1 stat - Should Contain ${result.stdout} Messages scanned: - + Check Rspamc ${result} Messages scanned: PASSWORD - CATENA WRONG [Setup] Password Setup ${CATENA_PASSWORD} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q stat - Should Contain ${result.stdout} Unauthorized rc_nocheck=1 + Check Rspamc ${result} Unauthorized PASSWORD - ENABLE [Setup] Password Setup ${CATENA_PASSWORD} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q2 stat_reset - Should Contain ${result.stdout} Messages scanned: + Check Rspamc ${result} Messages scanned: PASSWORD - ENABLE WITH NORMAL [Setup] Password Setup ${CATENA_PASSWORD} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q1 stat_reset - Should Contain ${result.stdout} Unauthorized rc_nocheck=1 + Check Rspamc ${result} Unauthorized PASSWORD - ENABLE INCORRECT [Setup] Password Setup ${CATENA_PASSWORD} ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} -P q2q2 stat_reset - Should Contain ${result.stdout} Unauthorized rc_nocheck=1 + Check Rspamc ${result} Unauthorized *** Keywords *** Password Setup [Arguments] ${PASSWORD} ${ENABLE_PASSWORD}=q2 Set Test Variable ${PASSWORD} Set Test Variable ${ENABLE_PASSWORD} - Generic Setup \ No newline at end of file + Generic Setup diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index 1daabe1c9..c3fe66a00 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -17,7 +17,9 @@ Check Rspamc \ ... ELSE Check Rspamc Match String ${result.stdout} ${i} ${inverse} Run Keyword If @{args} == @{EMPTY} Check Rspamc Match Default ${result.stdout} ${inverse} ${rc_nocheck} = Evaluate 'rc_nocheck' in $kwargs + ${rc_noinverse} = Evaluate 'rc_noinverse' in $kwargs Run Keyword If ${rc_nocheck} == True Return From Keyword + ${inverse} = Set Variable If ${rc_noinverse} == True False ${inverse} Run Keyword If ${inverse} == False Should Be Equal As Integers ${result.rc} ${rc} ... ELSE Should Not Be Equal As Integers ${result.rc} ${rc} -- 2.39.5