diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-08-04 17:34:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-04 17:34:56 +0100 |
commit | a569362933d9fb6993721d68a3e3179bb5ac7b6c (patch) | |
tree | 04b018619dd2f1113e52813a96dbdddd2d2344b9 /test/functional | |
parent | 6d33b6d3b8c824c6bc57830286939161ae4d1ff6 (diff) | |
parent | 255287d6edbc8fded03a5d065aa1e5af083a213e (diff) | |
download | rspamd-a569362933d9fb6993721d68a3e3179bb5ac7b6c.tar.gz rspamd-a569362933d9fb6993721d68a3e3179bb5ac7b6c.zip |
Merge pull request #809 from fatalbanana/rcpt
[Test] Add test for recipient parsing sanity
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/cases/101_lua.robot | 6 | ||||
-rw-r--r-- | test/functional/lua/recipients.lua | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/functional/cases/101_lua.robot b/test/functional/cases/101_lua.robot index 81c08ceee..9c0345688 100644 --- a/test/functional/cases/101_lua.robot +++ b/test/functional/cases/101_lua.robot @@ -28,6 +28,12 @@ Pre and Post Filters Check Rspamc ${result} TEST_PRE Should Contain ${result.stdout} TEST_POST +Recipient Parsing Sanity + [Setup] Lua Setup ${TESTDIR}/lua/recipients.lua + ${result} = Scan Message With Rspamc ${MESSAGE} -r rcpt1@foobar -r rcpt2@foobar + ... -r rcpt3@foobar -r rcpt4@foobar + Check Rspamc ${result} TEST_RCPT[rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar] + *** Keywords *** Lua Setup [Arguments] ${LUA_SCRIPT} diff --git a/test/functional/lua/recipients.lua b/test/functional/lua/recipients.lua new file mode 100644 index 000000000..f11c1a827 --- /dev/null +++ b/test/functional/lua/recipients.lua @@ -0,0 +1,14 @@ +rspamd_config:register_symbol({ + name = 'TEST_RCPT', + score = 1.0, + callback = function(task) + local l = {} + local rcpts = task:get_recipients(1) + for _, r in ipairs(rcpts) do + table.insert(l, r['addr']) + end + table.sort(l) + local t = table.concat(l, ",") + return true, t + end +}) |