summaryrefslogtreecommitdiff
path: root/rt/t/web/rest-non-ascii-subject.t
diff options
context:
space:
mode:
authorivan <ivan>2009-12-31 13:16:41 +0000
committerivan <ivan>2009-12-31 13:16:41 +0000
commit63a268637b2d51a8766412617724b9436439deb6 (patch)
treea50f6d4c7829d5c80905e989144317192a44dc90 /rt/t/web/rest-non-ascii-subject.t
parent65a561e3cd8c1ba94f6282f5d2a1cd9783afbd21 (diff)
parentb4b0c7e72d7eaee2fbfc7022022c9698323203dd (diff)
This commit was generated by cvs2svn to compensate for changes in r8690,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/t/web/rest-non-ascii-subject.t')
-rw-r--r--rt/t/web/rest-non-ascii-subject.t55
1 files changed, 55 insertions, 0 deletions
diff --git a/rt/t/web/rest-non-ascii-subject.t b/rt/t/web/rest-non-ascii-subject.t
new file mode 100644
index 000000000..70c910afe
--- /dev/null
+++ b/rt/t/web/rest-non-ascii-subject.t
@@ -0,0 +1,55 @@
+#!/usr/bin/env perl
+# Test ticket creation with REST using non ascii subject
+use strict;
+use warnings;
+use RT::Test tests => 7;
+
+local $RT::Test::SKIP_REQUEST_WORK_AROUND = 1;
+
+use Encode;
+# \x{XX} where XX is less than 255 is not treated as unicode code point
+my $subject = Encode::decode('latin1', "Sujet accentu\x{e9}");
+my $text = Encode::decode('latin1', "Contenu accentu\x{e9}");
+
+my ($baseurl, $m) = RT::Test->started_ok;
+
+my $queue = RT::Test->load_or_create_queue(Name => 'General');
+ok($queue->Id, "loaded the General queue");
+
+my $content = "id: ticket/new
+Queue: General
+Requestor: root
+Subject: $subject
+Cc:
+AdminCc:
+Owner:
+Status: new
+Priority:
+InitialPriority:
+FinalPriority:
+TimeEstimated:
+Starts: 2009-03-10 16:14:55
+Due: 2009-03-10 16:14:55
+Text: $text";
+
+$m->post("$baseurl/REST/1.0/ticket/new", [
+ user => 'root',
+ pass => 'password',
+# error message from HTTP::Message: content must be bytes
+ content => Encode::encode_utf8($content),
+], Content_Type => 'form-data' );
+
+my ($id) = $m->content =~ /Ticket (\d+) created/;
+ok($id, "got ticket #$id");
+
+my $ticket = RT::Ticket->new($RT::SystemUser);
+$ticket->Load($id);
+is($ticket->Id, $id, "loaded the REST-created ticket");
+is($ticket->Subject, $subject, "ticket subject successfully set");
+
+my $attach = $ticket->Transactions->First->Attachments->First;
+is($attach->Subject, $subject, "attachement subject successfully set");
+TODO: {
+ local $TODO = "Not fixed yet, but not a regression";
+ is($attach->GetHeader('Subject'), $subject, "attachement header subject successfully set");
+}