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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
require "vnd.dovecot.testsuite";
require "vacation";
require "variables";
test_set "message" text:
From: stephan@example.org
Subject: frop
References: <1234@local.machine.example> <3456@example.net>
<435444@ttms.com> <4223@froop.example.net> <m345444444@message-id.exp>
Message-ID: <432df324@example.org>
To: nico@frop.example.org
Frop
.
;
test "UTF-8 Subject" {
/* Trigger vacation response with rediculous Russian subject */
vacation :subject "Auto: Я могу есть стекло, оно мне не вредит."
"I am not in today";
/* Execute Sieve result (sending message to dummy SMTP) */
if not test_result_execute {
test_fail "execution of result failed";
}
/* Retrieve message from dummy SMTP and set it as the active message under
* test.
*/
test_message :smtp 0;
set "expected" "Auto: Я могу есть стекло, оно мне не вредит.";
if not header :is "subject" "${expected}" {
if header :matches "subject" "*" { set "subject" "${1}"; }
test_fail text:
subject header is not encoded/decoded properly:
expected: ${expected}
decoded: ${subject}
.
;
}
}
test_result_reset;
test_set "message" text:
From: stephan@example.org
Subject: frop
References: <1234@local.machine.example> <3456@example.net>
<435444@ttms.com> <4223@froop.example.net> <m345444444@message-id.exp>
Message-ID: <432df324@example.org>
To: nico@frop.example.org
Frop
.
;
test "MIME Encoded Subject" {
/* Trigger vacation response with rediculous Russian subject */
vacation :subject "=?utf-8?b?w4TDlsOc?= sadasd"
"I am not in today";
/* Execute Sieve result (sending message to dummy SMTP) */
if not test_result_execute {
test_fail "execution of result failed";
}
/* Retrieve message from dummy SMTP and set it as the active message under
* test.
*/
test_message :smtp 0;
set "expected" "ÄÖÜ sadasd";
if not header :is "subject" "${expected}" {
if header :matches "subject" "*" { set "subject" "${1}"; }
test_fail text:
subject header is not encoded/decoded properly:
expected: ${expected}
decoded: ${subject}
.
;
}
}
|