X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fmail%2Fheader-characters.t;h=38a04b5df86f654cec75530e0084de5edd7d061d;hb=31d3be5e80b4c92367dc84fea9f8bf3ee2d14480;hp=004ba8522f8b23f400f3e167ed50fde1408d7c35;hpb=4e7efe58f1a20dfc4fd306fad2c14c8040585be1;p=freeside.git diff --git a/rt/t/mail/header-characters.t b/rt/t/mail/header-characters.t index 004ba8522..38a04b5df 100644 --- a/rt/t/mail/header-characters.t +++ b/rt/t/mail/header-characters.t @@ -6,14 +6,10 @@ use Test::Warn; my ($baseurl, $m) = RT::Test->started_ok; -diag "Testing non-ASCII in From: header"; -SKIP:{ - skip "Test requires Email::Address 1.893 or later, " - . "you have $Email::Address::VERSION", 3, - if $Email::Address::VERSION < 1.893; - +diag "Testing non-ASCII latin1 in From: header"; +{ my $mail = Encode::encode( 'iso-8859-1', Encode::decode( "UTF-8", <<'.') ); -From: René@example.com> +From: Reply-To: =?iso-8859-1?Q?Ren=E9?= Subject: testing non-ASCII From Content-Type: text/plain; charset=iso-8859-1 @@ -23,24 +19,20 @@ here's some content my ($status, $id); warnings_like { ( $status, $id ) = RT::Test->send_via_mailgate($mail) } - [qr/Failed to parse Reply-To:.*, From:/, + [(qr/Unable to parse an email address from/) x 2, qr/Couldn't parse or find sender's address/ ], 'Got parse error for non-ASCII in From'; - is( $status >> 8, 0, "The mail gateway exited normally" ); TODO: { - local $TODO = "Currently don't handle non-ASCII for sender"; - ok( $id, "Created ticket" ); - } + local $TODO = "Currently don't handle non-ASCII for sender"; + is( $status >> 8, 0, "The mail gateway exited normally" ); + ok( $id, "Created ticket" ); + } } -diag "Testing iso-8859-1 encoded non-ASCII in From: header"; -SKIP:{ - skip "Test requires Email::Address 1.893 or later, " - . "you have $Email::Address::VERSION", 3, - if $Email::Address::VERSION < 1.893; - - my $mail = Encode::encode( 'iso-8859-1', Encode::decode( "UTF-8", <<'.' ) ); +diag "Testing non-ASCII latin1 in From: header with MIME-word-encoded phrase"; +{ + my $mail = Encode::encode( 'iso-8859-1', Encode::decode( "UTF-8", <<'.') ); From: =?iso-8859-1?Q?Ren=E9?= Reply-To: =?iso-8859-1?Q?Ren=E9?= Subject: testing non-ASCII From @@ -51,14 +43,14 @@ here's some content my ($status, $id); warnings_like { ( $status, $id ) = RT::Test->send_via_mailgate($mail) } - [qr/Failed to parse Reply-To:.*, From:/, + [(qr/Unable to parse an email address from/) x 2, qr/Couldn't parse or find sender's address/ ], 'Got parse error for iso-8859-1 in From'; - is( $status >> 8, 0, "The mail gateway exited normally" ); TODO: { - local $TODO = "Currently don't handle non-ASCII in sender"; - ok( $id, "Created ticket" ); + local $TODO = "Currently don't handle non-ASCII in sender"; + is( $status >> 8, 0, "The mail gateway exited normally" ); + ok( $id, "Created ticket" ); } } @@ -76,6 +68,6 @@ here's some content warnings_like { ( $status, $id ) = RT::Test->send_via_mailgate($mail) } [qr/Couldn't parse or find sender's address/], 'Got parse error with no sender fields'; - is( $status >> 8, 0, "The mail gateway exited normally" ); + is( $status >> 8, 1, "The mail gateway failed" ); ok( !$id, "No ticket created" ); }