From: Andrew Lewis Date: Mon, 13 Feb 2017 16:13:07 +0000 (+0200) Subject: [Test] Add tests for multimap received maps X-Git-Tag: 1.5.0~107^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b031412b168dd53c26948bc559d7b47ed679c06b;p=rspamd.git [Test] Add tests for multimap received maps --- diff --git a/test/functional/cases/102_multimap.robot b/test/functional/cases/102_multimap.robot index 89bafe750..161c9055b 100644 --- a/test/functional/cases/102_multimap.robot +++ b/test/functional/cases/102_multimap.robot @@ -11,6 +11,8 @@ ${MESSAGE} ${TESTDIR}/messages/spam_message.eml ${UTF_MESSAGE} ${TESTDIR}/messages/utf.eml ${REDIS_SCOPE} Suite ${RSPAMD_SCOPE} Suite +${RCVD1} ${TESTDIR}/messages/received1.eml +${RCVD2} ${TESTDIR}/messages/received2.eml ${URL1} ${TESTDIR}/messages/url1.eml ${URL2} ${TESTDIR}/messages/url2.eml ${URL3} ${TESTDIR}/messages/url3.eml @@ -254,6 +256,16 @@ MAP - REDIS - ASN FILTERED - MISS ${result} = Scan Message With Rspamc ${MESSAGE} -i 46.228.47.114 Check Rspamc ${result} REDIS_ASN_FILTERED inverse=1 +MAP - RECEIVED - IP MINMAX POS - ONE + ${result} = Scan Message With Rspamc ${RCVD1} + Check Rspamc ${result} RCVD_TEST_01 + Check Rspamc ${result} RCVD_TEST_02 inverse=1 + +MAP - RECEIVED - IP MINMAX POS - TWO + ${result} = Scan Message With Rspamc ${RCVD2} + Check Rspamc ${result} RCVD_TEST_02 + Check Rspamc ${result} RCVD_TEST_01 inverse=1 + *** Keywords *** Multimap Setup ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/multimap.conf diff --git a/test/functional/configs/maps/rcvd.list b/test/functional/configs/maps/rcvd.list new file mode 100644 index 000000000..5c5971100 --- /dev/null +++ b/test/functional/configs/maps/rcvd.list @@ -0,0 +1 @@ +2a01:7c8:aab6:26d:5054:ff:fed1:1da2 diff --git a/test/functional/configs/multimap.conf b/test/functional/configs/multimap.conf index d28b8a8bf..538e21e7b 100644 --- a/test/functional/configs/multimap.conf +++ b/test/functional/configs/multimap.conf @@ -122,4 +122,14 @@ multimap { map = "redis://asn"; filter = "regexp:/^([0-9]).*/"; } + RCVD_TEST_01 { + type = "received"; + max_pos = 1; + map = "${TESTDIR}/configs/maps/rcvd.list"; + } + RCVD_TEST_02 { + type = "received"; + min_pos = -2; + map = "${TESTDIR}/configs/maps/rcvd.list"; + } } diff --git a/test/functional/messages/received1.eml b/test/functional/messages/received1.eml new file mode 100644 index 000000000..6cc552934 --- /dev/null +++ b/test/functional/messages/received1.eml @@ -0,0 +1,16 @@ +Received: from server.chat-met-vreemden.nl (unknown [IPv6:2a01:7c8:aab6:26d:5054:ff:fed1:1da2]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (Client did not present a certificate) + by mx1.freebsd.org (Postfix) with ESMTPS id CF0171862 + for ; Mon, 6 Jul 2015 09:01:20 +0000 (UTC) + (envelope-from upwest201diana@outlook.com) +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) + (envelope-from ) + id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200 +Received: apparently +Received: or is it +MIME-Version: 1.0 +Content-Type: text/plain + +Hello diff --git a/test/functional/messages/received2.eml b/test/functional/messages/received2.eml new file mode 100644 index 000000000..b5587e89d --- /dev/null +++ b/test/functional/messages/received2.eml @@ -0,0 +1,16 @@ +Received: apparently +Received: or is it +Received: from server.chat-met-vreemden.nl (unknown [IPv6:2a01:7c8:aab6:26d:5054:ff:fed1:1da2]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (Client did not present a certificate) + by mx1.freebsd.org (Postfix) with ESMTPS id CF0171862 + for ; Mon, 6 Jul 2015 09:01:20 +0000 (UTC) + (envelope-from upwest201diana@outlook.com) +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) + (envelope-from ) + id 1ZC1sl-0006b4-TU; Mon, 06 Jul 2015 10:36:08 +0200 +MIME-Version: 1.0 +Content-Type: text/plain + +Hello