| 1 |
*** Settings *** |
| 2 |
Suite Setup Rspamadm Setup |
| 3 |
Suite Teardown Rspamadm Teardown |
| 4 |
Library ${RSPAMD_TESTDIR}/lib/rspamd.py |
| 5 |
Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot |
| 6 |
Test Timeout 1 minute |
| 7 |
|
| 8 |
*** Variables *** |
| 9 |
${TEXT} text |
| 10 |
${KEY} 12345678901234567890123456789012 |
| 11 |
${NONCE} 9pyeEd986hrjcpozCIZ41jEo6dCDbgjg |
| 12 |
${ENCRYPTED_TEXT} 8KGF6VLI7vnweUdR8FuQZuT+ID8= |
| 13 |
${PYTHON_SCRIPT} ${RSPAMD_TESTDIR}/../../utils/encrypt_decrypt_header.py |
| 14 |
|
| 15 |
*** Test Cases *** |
| 16 |
Config Test |
| 17 |
${result} = Rspamadm configtest |
| 18 |
Should Match Regexp ${result.stderr} ^$ |
| 19 |
Should Match Regexp ${result.stdout} ^syntax OK$ |
| 20 |
Should Be Equal As Integers ${result.rc} 0 |
| 21 |
|
| 22 |
Config Help |
| 23 |
${result} = Rspamadm confighelp |
| 24 |
Should Match Regexp ${result.stderr} ^$ |
| 25 |
Should Be Equal As Integers ${result.rc} 0 |
| 26 |
|
| 27 |
Simple interpreter |
| 28 |
${handle} = Start Process ${RSPAMADM} lua stdin=PIPE |
| 29 |
${result} = Write to stdin ${handle} 1+1 |
| 30 |
Should Be Equal As Strings ${result} 2\n |
| 31 |
Wait For Process ${handle} |
| 32 |
|
| 33 |
Simple interpreter, two results |
| 34 |
${handle} = Start Process ${RSPAMADM} lua stdin=PIPE |
| 35 |
${result} = Write to stdin ${handle} 1+1, 2 * 5 |
| 36 |
Should Be Equal ${result} 2\n10\n |
| 37 |
Wait For Process ${handle} |
| 38 |
|
| 39 |
Process message callback |
| 40 |
${handle} = Start Process ${RSPAMADM} lua stdin=PIPE |
| 41 |
${result} = Write to stdin ${handle} .load ${RSPAMD_TESTDIR}/lua/rspamadm/test_message_callback.lua\n.message message_callback ${RSPAMD_TESTDIR}/messages/empty_part.eml |
| 42 |
Should Contain ${result} n parts = 2 |
| 43 |
Should Contain ${result} 1\n2\n4\n6 |
| 44 |
Wait For Process ${handle} |
| 45 |
|
| 46 |
Lua batch mode |
| 47 |
${result} = Rspamadm lua -b ${RSPAMD_TESTDIR}/lua/rspamadm/test_batch.lua |
| 48 |
Should Be Equal ${result.stderr} hello world |
| 49 |
Should Match Regexp ${result.stdout} ^$ |
| 50 |
Should Be Equal As Integers ${result.rc} 0 |
| 51 |
|
| 52 |
Verbose mode |
| 53 |
${result} = Rspamadm -v lua ${RSPAMD_TESTDIR}/lua/rspamadm/test_verbose.lua |
| 54 |
Should Match Regexp ${result.stderr} ^$ |
| 55 |
Should Match Regexp ${result.stdout} hello world\n |
| 56 |
Should Be Equal As Integers ${result.rc} 0 |
| 57 |
|
| 58 |
SecretBox rspamadm encrypt/decrypt |
| 59 |
${result} = Rspamadm secret_box -B encrypt -t ${TEXT} -k ${KEY} -n ${NONCE} |
| 60 |
Should Match Regexp ${result.stderr} ^$ |
| 61 |
Should Be Equal As Strings ${result.stdout} ${NONCE}${ENCRYPTED_TEXT} |
| 62 |
${result1} = Rspamadm secret_box -B decrypt -t ${ENCRYPTED_TEXT} -k ${KEY} -n ${NONCE} |
| 63 |
Should Match Regexp ${result.stderr} ^$ |
| 64 |
Should Be Equal As Strings ${result1.stdout} ${TEXT} |
| 65 |
|
| 66 |
SecretBox python encrypt/decrypt |
| 67 |
${result} = Run Process python3 ${PYTHON_SCRIPT} -B encrypt -t ${TEXT} -k ${KEY} -n ${NONCE} |
| 68 |
Should Match Regexp ${result.stderr} ^$ |
| 69 |
Should Be Equal As Strings ${result.stdout} ${NONCE}${ENCRYPTED_TEXT} |
| 70 |
${result1} = Run Process python3 ${PYTHON_SCRIPT} -B decrypt -t ${NONCE}${ENCRYPTED_TEXT} -k ${KEY} |
| 71 |
Should Match Regexp ${result.stderr} ^$ |
| 72 |
Should Be Equal As Strings ${result1.stdout} ${TEXT} |
| 73 |
|
| 74 |
SecretBox encrypt python with nonce decrypt rspamadm |
| 75 |
${result} = Run Process python3 ${PYTHON_SCRIPT} -B encrypt -t ${TEXT} -k ${KEY} -n ${NONCE} |
| 76 |
${result1} = Rspamadm secret_box -B decrypt -t ${result.stdout} -k ${KEY} |
| 77 |
Should Match Regexp ${result.stderr} ^$ |
| 78 |
Should Be Equal As Strings ${TEXT} ${result1.stdout} |
| 79 |
|
| 80 |
SecretBox encrypt python without nonce decrypt rspamadm |
| 81 |
${result} = Run Process python3 ${PYTHON_SCRIPT} -B encrypt -t ${TEXT} -k ${KEY} |
| 82 |
${result1} = Rspamadm secret_box -B decrypt -t ${result.stdout} -k ${KEY} |
| 83 |
Should Match Regexp ${result.stderr} ^$ |
| 84 |
Should Be Equal As Strings ${TEXT} ${result1.stdout} |
| 85 |
|
| 86 |
SecretBox encrypt rspamadm with nonce decrypt python |
| 87 |
${result} = Rspamadm secret_box -B encrypt -t ${TEXT} -k ${KEY} -n ${NONCE} |
| 88 |
${result1} = Run Process python3 ${PYTHON_SCRIPT} -B decrypt -t ${result.stdout} -k ${KEY} |
| 89 |
Should Match Regexp ${result.stderr} ^$ |
| 90 |
Should Be Equal As Strings ${TEXT} ${result1.stdout} |
| 91 |
|
| 92 |
SecretBox encrypt rspamadm without nonce decrypt python |
| 93 |
${result} = Rspamadm secret_box -B encrypt -t ${TEXT} -k ${KEY} |
| 94 |
${result1} = Run Process python3 ${PYTHON_SCRIPT} -B decrypt -t ${result.stdout} -k ${KEY} |
| 95 |
Should Match Regexp ${result.stderr} ^$ |
| 96 |
Should Be Equal As Strings ${TEXT} ${result1.stdout} |