diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-11 18:17:31 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-12-11 18:17:31 +0000 |
commit | 98de6bab57e6bb441794f1622a1df38f58c4c3be (patch) | |
tree | 115ebbd1b09be0491a34381d58cb4ebf1b705a66 /test/lua | |
parent | 2398d3465cc8b745c22b421564d89a8354f0150f (diff) | |
download | rspamd-98de6bab57e6bb441794f1622a1df38f58c4c3be.tar.gz rspamd-98de6bab57e6bb441794f1622a1df38f58c4c3be.zip |
[Test] Add tests for first/last transforms
Diffstat (limited to 'test/lua')
-rw-r--r-- | test/lua/unit/selectors.lua | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/test/lua/unit/selectors.lua b/test/lua/unit/selectors.lua index e8e8c0b47..0aa0bab47 100644 --- a/test/lua/unit/selectors.lua +++ b/test/lua/unit/selectors.lua @@ -141,7 +141,17 @@ context("Selectors test", function() ["received by hostname"] = { selector = "received:by_hostname", - expect = {{"server.chat-met-vreemden.nl"}}}, + expect = {{"server1.chat-met-vreemden.nl", "server2.chat-met-vreemden.nl"}}}, + + ["received by hostname last"] = { + selector = "received:by_hostname.last", + expect = {"server2.chat-met-vreemden.nl"} + }, + + ["received by hostname first"] = { + selector = "received:by_hostname.first", + expect = {"server1.chat-met-vreemden.nl"} + }, ["urls"] = { selector = "urls", @@ -247,6 +257,10 @@ context("Selectors test", function() selector = "rcpts.nth(2).lower", expect = {'no-one@example.com'}}, + ["transformation last"] = { + selector = "rcpts.last.lower", + expect = {'no-one@example.com'}}, + ["transformation substring"] = { selector = "header(Subject, strong).substring(6)", expect = {'subject'}}, @@ -305,8 +319,12 @@ end) --[=========[ ******************* message ******************* ]=========] msg = [[ -Received: from ca-18-193-131.service.infuturo.it ([151.18.193.131] helo=User) - by server.chat-met-vreemden.nl with esmtpa (Exim 4.76) +Received: from ca-18-193-131.service1.infuturo.it ([151.18.193.131] helo=User) + by server1.chat-met-vreemden.nl with esmtpa (Exim 4.76) + (envelope-from <upwest201diana@outlook.com>) + id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200 +Received: from ca-18-193-131.service2.infuturo.it ([151.18.193.132] helo=User) + by server2.chat-met-vreemden.nl with esmtpa (Exim 4.76) (envelope-from <upwest201diana@outlook.com>) id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200 From: <whoknows@nowhere.com> |