diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-09-03 13:06:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 13:06:31 +0100 |
commit | 74a6f8cc42d902ef10fe70b633a4d11735e578d2 (patch) | |
tree | 832e4a84a67d7c91a733e96a4779581a6ef13e98 /test | |
parent | 3edd0268e39ab1c05ac14c59b67993bd5ad0b84f (diff) | |
parent | b7f5a57f6fe0705ed1e21fbdbaa9ca4992daecce (diff) | |
download | rspamd-74a6f8cc42d902ef10fe70b633a4d11735e578d2.tar.gz rspamd-74a6f8cc42d902ef10fe70b633a4d11735e578d2.zip |
Merge pull request #3483 from korgoth1/master
[TEST] FNames
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/cases/280_rules.robot | 1 | ||||
-rw-r--r-- | test/functional/cases/281_fnames.robot | 30 | ||||
-rw-r--r-- | test/functional/lua/test_fname.lua | 12 | ||||
-rw-r--r-- | test/functional/messages/fname.eml | 29 |
4 files changed, 72 insertions, 0 deletions
diff --git a/test/functional/cases/280_rules.robot b/test/functional/cases/280_rules.robot index 6c5c1ac62..72393677d 100644 --- a/test/functional/cases/280_rules.robot +++ b/test/functional/cases/280_rules.robot @@ -110,6 +110,7 @@ PHISH_SENDER_ROUTING_PART ${result} = Scan Message With Rspamc ${TESTDIR}/messages/phish_sender6.eml Should Contain ${result.stdout} FROM_INVALID + *** Keywords *** Rules Setup ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/regexp.conf diff --git a/test/functional/cases/281_fnames.robot b/test/functional/cases/281_fnames.robot new file mode 100644 index 000000000..9e3d37b57 --- /dev/null +++ b/test/functional/cases/281_fnames.robot @@ -0,0 +1,30 @@ +*** Settings *** +Suite Setup Fnames Setup +Suite Teardown Fnames Teardown +Library ${TESTDIR}/lib/rspamd.py +Resource ${TESTDIR}/lib/rspamd.robot +Variables ${TESTDIR}/lib/vars.py + +*** Variables *** +${CONFIG} ${TESTDIR}/configs/lua_script.conf +${LUA_SCRIPT} ${TESTDIR}/lua/test_fname.lua +${RSPAMD_SCOPE} Suite +${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat + + +*** Test Cases *** +FILE NAMES + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/fname.eml + Should Contain ${result.stdout} TEST_FNAME + Should Contain ${result.stdout} [삼성생명]2020.08.14 데일리 경제뉴스.pdf, 01029_402110_10620_RGT06902_PRT180ML_20200803_101820.pdf + + +*** Keywords *** +Fnames Setup + ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/regexp.conf + Set Suite Variable ${PLUGIN_CONFIG} + Generic Setup PLUGIN_CONFIG + +Fnames Teardown + Normal Teardown + Terminate All Processes kill=True
\ No newline at end of file diff --git a/test/functional/lua/test_fname.lua b/test/functional/lua/test_fname.lua new file mode 100644 index 000000000..ffa7bb99f --- /dev/null +++ b/test/functional/lua/test_fname.lua @@ -0,0 +1,12 @@ +rspamd_config.TEST_FNAME = { + callback = function(task) + local r = task:get_parts() + local fnames = {} + for _,rh in ipairs(r) do + if rh:get_filename() then + table.insert(fnames, rh:get_filename()) + end + end + return true,1.0,fnames + end +}
\ No newline at end of file diff --git a/test/functional/messages/fname.eml b/test/functional/messages/fname.eml new file mode 100644 index 000000000..045940c63 --- /dev/null +++ b/test/functional/messages/fname.eml @@ -0,0 +1,29 @@ +Received: by mail-lf1-f54.gulugulu.com with SMTP id j14so14439709lfg.9 + for <test@test.ru>; Mon, 27 Apr 2020 09:54:21 -0700 (PDT) +From: test@test.com +Date: Mon, 27 Apr 2020 19:54:10 +0300 +Message-ID: <CA+1S=h4aGimA6vSBJF=t1F+5z-Mua5+Cimf+NU_NDWJk8ZNOcw@mail.gmail.com> +Subject: Fwd: +To: <test@test.ru> +Content-Type: multipart/mixed; boundary="00000000000004de7805a4489190" + +--00000000000004de7805a4489190 +Content-Type: application/octet-stream +Content-Disposition: attachment; + filename="=?UTF-8?B?W+yCvOyEseyDneuqhV0yMDIwLjA4Lg==?= + =?UTF-8?B?MTQg642w7J2866asIOqyveygnOuJtOyKpC5wZGY=?=" +Content-Transfer-Encoding: base64 + +yCvOy + +--00000000000004de7805a4489190 +Content-Type: application/pdf; + name==?utf-8?B?MDEwMjlfNDAyMTEwXzEwNjIwX1JHVDA2OTAyX1BSVDE4ME1MXzIwMjAwODAzXzEwMTgyMC5wZGY=?= +Content-Disposition: attachment; + filename==?utf-8?B?MDEwMjlfNDAyMTEwXzEwNjIwX1JHVDA2OTAyX1BSVDE4ME1MXzIwMjAwODAzXzEwMTgyMC5wZGY=?= +Content-Transfer-Encoding: base64 + +yCvOy + + +--00000000000004de7805a4489190--
\ No newline at end of file |