Procházet zdrojové kódy

[Test] Add test for recipient parsing sanity

tags/1.3.2
Andrew Lewis před 8 roky
rodič
revize
255287d6ed

+ 6
- 0
test/functional/cases/101_lua.robot Zobrazit soubor

@@ -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}

+ 14
- 0
test/functional/lua/recipients.lua Zobrazit soubor

@@ -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
})

Načítá se…
Zrušit
Uložit