aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-14 09:05:34 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-14 09:05:34 +0100
commit0758fd8c4cc9b9698972e9782af51bbd5c1ff001 (patch)
tree018f4fa17517d742305ceeb5f3a5a28d047f1940
parent2c02496877f8f0d6263eb1e4a5e2ca89fe269d59 (diff)
downloadrspamd-0758fd8c4cc9b9698972e9782af51bbd5c1ff001.tar.gz
rspamd-0758fd8c4cc9b9698972e9782af51bbd5c1ff001.zip
[Test] Add more mime tests
-rw-r--r--test/lua/unit/task.lua48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/lua/unit/task.lua b/test/lua/unit/task.lua
index 3ec583043..e9fc9e7d5 100644
--- a/test/lua/unit/task.lua
+++ b/test/lua/unit/task.lua
@@ -111,4 +111,52 @@ Thank you,
task:destroy()
end)
+ test("Process mime nesting: message in multipart", function()
+ local msg = table.concat{
+ hdrs, mpart, '\n',
+ '--XXX\n',
+ 'Content-Type: message/rfc822\n', '\n', hdrs, body ,
+ '\n--XXX--\n',
+ }
+
+ local res,task = rspamd_task.load_from_string(msg)
+ assert_true(res, "failed to load message")
+ task:process_message()
+ assert_rspamd_table_eq({
+ actual = fun.totable(fun.map(function(u)
+ return u:get_host()
+ end, task:get_urls())),
+
+ expect = {
+ 'evil.com', 'example.com'
+ }})
+
+ task:destroy()
+ end)
+ test("Process mime nesting: multipart message in multipart", function()
+ local msg = table.concat{
+ hdrs, mpart, '\n',
+ '--XXX\n',
+ 'Content-Type: message/rfc822\n', '\n', hdrs, mpart, '\n',
+
+ '--XXX\n',
+ body ,
+ '\n--XXX--\n',
+
+ '\n--XXX--\n',
+ }
+ local res,task = rspamd_task.load_from_string(msg)
+ assert_true(res, "failed to load message")
+ task:process_message()
+ assert_rspamd_table_eq({
+ actual = fun.totable(fun.map(function(u)
+ return u:get_host()
+ end, task:get_urls())),
+
+ expect = {
+ 'evil.com', 'example.com'
+ }})
+
+ task:destroy()
+ end)
end) \ No newline at end of file