commit 98de6ba: [Test] Add tests for first/last transforms
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Dec 11 18:21:09 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-12-11 18:17:31 +0000
URL: https://github.com/rspamd/rspamd/commit/98de6bab57e6bb441794f1622a1df38f58c4c3be (HEAD -> master)
[Test] Add tests for first/last transforms
---
test/lua/unit/selectors.lua | 24 +++++++++++++++++++++---
1 file 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 at example.com'}},
+ ["transformation last"] = {
+ selector = "rcpts.last.lower",
+ expect = {'no-one at 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 at 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 at outlook.com>)
id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200
From: <whoknows at nowhere.com>
More information about the Commits
mailing list