aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/104_get_from.robot
blob: c15e0cdba0a79cf639085db6b1af3262b0649145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
*** Settings ***
Suite Setup     Generic Setup
Suite Teardown  Simple 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/get_from.lua
${RSPAMD_SCOPE}  Suite

${SYMBOL}   GET_FROM
${OPTIONS1}  ,user@example.org,user,example.org
${OPTIONS2}  First Last,user@example.org,user,example.org
${OPTIONS3}  First M. Last,user@example.org,user,example.org

*** Test Cases ***
task:get_from('mime') - address only
  Scan File  ${TESTDIR}/messages/from/from.eml
  Expect Symbol  ${SYMBOL}

task:get_from('mime') - comment
  Scan File  ${TESTDIR}/messages/from/from_comment.eml
  Expect Symbol With Exact Options  ${SYMBOL}  ${OPTIONS1}

task:get_from('mime') - display name
  Scan File  ${TESTDIR}/messages/from/from_dn.eml
  Expect Symbol With Exact Options  ${SYMBOL}  ${OPTIONS2}

task:get_from('mime') - display name Base64
  Scan File  ${TESTDIR}/messages/from/from_dn_base64.eml
  Expect Symbol With Exact Options  ${SYMBOL}  Кириллица,user@example.org,user,example.org

task:get_from('mime') - display name and comment
  Scan File  ${TESTDIR}/messages/from/from_dn_comment.eml
  Expect Symbol With Exact Options  ${SYMBOL}  ${OPTIONS2}

task:get_from('mime') - quoted display name
  Scan File  ${TESTDIR}/messages/from/from_quoted_dn.eml
  Expect Symbol With Exact Options  ${SYMBOL}  ${OPTIONS3}

task:get_from('mime') - quoted display name and comment
  Scan File  ${TESTDIR}/messages/from/from_quoted_dn_comment.eml
  Expect Symbol With Exact Options  ${SYMBOL}  ${OPTIONS3}

task:get_from('mime') - quoted in the middle of DN (outer spaces)
  Scan File  ${TESTDIR}/messages/from/from_quoted_dn_middle.eml
  Expect Symbol With Exact Options  ${SYMBOL}  ${OPTIONS3}

task:get_from('mime') - quoted in the middle of DN (inner spaces)
  Scan File  ${TESTDIR}/messages/from/from_quoted_dn_middle_inner.eml
  Expect Symbol With Exact Options  ${SYMBOL}  ${OPTIONS3}