From: Vsevolod Stakhov Date: Wed, 14 Aug 2019 08:05:34 +0000 (+0100) Subject: [Test] Add more mime tests X-Git-Tag: 2.0~430 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0758fd8c4cc9b9698972e9782af51bbd5c1ff001;p=rspamd.git [Test] Add more mime tests --- 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