[Rt-commit] rt branch, 4.4/require-han-extra-in-attachment-encoded-headers, updated. rt-4.4.2-239-gc1b100ae4

? sunnavy sunnavy at bestpractical.com
Fri May 11 18:51:28 EDT 2018


The branch, 4.4/require-han-extra-in-attachment-encoded-headers has been updated
       via  c1b100ae408f04619a325b9d5db50ff98cb5421a (commit)
      from  571f6090b886ad88185dc3e89013efe8a9bed68b (commit)

Summary of changes:
 t/check-modules                       |  6 ++++++
 t/data/emails/new-ticket-from-gb18030 | 10 ++++++++++
 t/mail/han-encodings.t                | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+)
 create mode 100755 t/check-modules
 create mode 100644 t/data/emails/new-ticket-from-gb18030
 create mode 100644 t/mail/han-encodings.t

- Log -----------------------------------------------------------------
commit c1b100ae408f04619a325b9d5db50ff98cb5421a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat May 12 06:08:19 2018 +0800

    Test RT::Attachment::EncodedHeaders with gb18030

diff --git a/t/check-modules b/t/check-modules
new file mode 100755
index 000000000..65e52930b
--- /dev/null
+++ b/t/check-modules
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use UNIVERSAL::require;
+$_->require or die $@ for @ARGV;
diff --git a/t/data/emails/new-ticket-from-gb18030 b/t/data/emails/new-ticket-from-gb18030
new file mode 100644
index 000000000..02257cd1e
--- /dev/null
+++ b/t/data/emails/new-ticket-from-gb18030
@@ -0,0 +1,10 @@
+Content-Type: text/plain; charset="gb18030"
+Content-Disposition: inline
+Content-Transfer-Encoding: base64
+MIME-Version: 1.0
+X-Mailer: MIME-tools 5.505 (Entity 5.505)
+From: root at localhost
+Subject: =?gb18030?B?suLK1A===?=
+
+suLK1A==
+
diff --git a/t/mail/han-encodings.t b/t/mail/han-encodings.t
new file mode 100644
index 000000000..fc321bd12
--- /dev/null
+++ b/t/mail/han-encodings.t
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+
+use RT::Test tests => undef, actual_server => 1;
+
+# we can't simply call Encode::HanExtra->require here because we are testing
+# if Encode::HanExtra could be automatically loaded.
+my $check_modules = RT::Test::get_relocatable_file( 'check-modules', File::Spec->updir() );
+plan skip_all => 'Encode::HanExtra required' if system $^X, $check_modules, 'Encode::HanExtra';
+
+my ( $baseurl, $m ) = RT::Test->started_ok;
+
+{
+    my $gb18030_ticket_email =
+      RT::Test::get_relocatable_file( 'new-ticket-from-gb18030', ( File::Spec->updir(), 'data', 'emails' ) );
+    my $content = RT::Test->file_content( $gb18030_ticket_email );
+
+    my ( $status, $id ) = RT::Test->send_via_mailgate_and_http( $content );
+    is( $status >> 8, 0, "The mail gateway exited normally" );
+    ok( $id, "Created ticket" );
+
+    my $ticket = RT::Ticket->new( RT->SystemUser );
+    $ticket->Load( $id );
+    ok( $ticket->id, 'loaded ticket' );
+
+    my $txns = $ticket->Transactions;
+    $txns->Limit( FIELD => 'Type', VALUE => 'Create' );
+    my $attachment     = $txns->First->Attachments->First;
+    my $encode_headers = $attachment->EncodedHeaders( 'gb18030' );
+    is( $encode_headers, Encode::encode( 'gb18030', $attachment->Headers ) );
+}
+
+done_testing;

-----------------------------------------------------------------------


More information about the rt-commit mailing list