[Rt-commit] rt branch, 4.0/dashboard-chart-with-utf8, created. rt-4.0.5-82-ga3ce59d

? sunnavy sunnavy at bestpractical.com
Fri Mar 2 06:59:08 EST 2012


The branch, 4.0/dashboard-chart-with-utf8 has been created
        at  a3ce59dd06478b0989100fe8640559715a172cbb (commit)

- Log -----------------------------------------------------------------
commit 92eda152e13098810bba60479c5b394c39e88c2d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 2 19:33:27 2012 +0800

    URI before 1.59 has a bug when initialized with decoded utf8 string.
    
    this could cause wrong results in dashboard email. see #18104

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 03c813b..5078cdd 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -339,6 +339,7 @@ Net::SMTP
 $deps{'DASHBOARDS'} = [ text_to_hash( << '.') ];
 HTML::RewriteAttributes 0.04
 MIME::Types
+URI 1.59
 .
 
 $deps{'GRAPHVIZ'} = [ text_to_hash( << '.') ];

commit a3ce59dd06478b0989100fe8640559715a172cbb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Mar 2 19:42:16 2012 +0800

    test dashboard chart in email with utf8 query

diff --git a/t/mail/dashboard-chart-with-utf8.t b/t/mail/dashboard-chart-with-utf8.t
new file mode 100644
index 0000000..6d07b96
--- /dev/null
+++ b/t/mail/dashboard-chart-with-utf8.t
@@ -0,0 +1,82 @@
+use strict;
+use warnings;
+
+use RT::Test tests => 15;
+use utf8;
+
+my $root = RT::Test->load_or_create_user( Name => 'root' );
+
+my ( $baseurl, $m ) = RT::Test->started_ok;
+ok( $m->login, 'logged in' );
+my $ticket = RT::Ticket->new( $RT::SystemUser );
+$ticket->Create(
+    Queue   => 'General',
+    Subject => 'test äöü',
+);
+ok( $ticket->id, 'created ticket' );
+
+$m->get_ok(q{/Search/Chart.html?Query=Subject LIKE 'test äöü'});
+$m->submit_form(
+    form_name => 'SaveSearch',
+    fields    => {
+        SavedSearchDescription => 'chart foo',
+        SavedSearchOwner       => 'RT::User-' . $root->id,
+    },
+    button => 'SavedSearchSave',
+);
+
+# first, create and populate a dashboard
+$m->get_ok('/Dashboards/Modify.html?Create=1');
+$m->form_name('ModifyDashboard');
+$m->field( 'Name' => 'dashboard foo' );
+$m->click_button( value => 'Create' );
+
+$m->follow_link_ok( { text => 'Content' } );
+my $form  = $m->form_name('Dashboard-Searches-body');
+my @input = $form->find_input('Searches-body-Available');
+my ($dashboards_component) =
+  map { ( $_->possible_values )[1] }
+  grep { ( $_->value_names )[1] =~ /^Chart/ } @input;
+$form->value( 'Searches-body-Available' => $dashboards_component );
+$m->click_button( name => 'add' );
+$m->content_contains('Dashboard updated');
+
+$m->follow_link_ok( { text => 'Subscription' } );
+$m->form_name('SubscribeDashboard');
+$m->field( 'Frequency' => 'daily' );
+$m->field( 'Hour'      => '06:00' );
+$m->click_button( name => 'Save' );
+$m->content_contains('Subscribed to dashboard dashboard foo');
+
+my $c     = $m->get(q{/Search/Chart?Query=Subject LIKE 'test äöü'});
+my $image = $c->content;
+RT::Test->run_and_capture(
+    command => $RT::SbinPath . '/rt-email-dashboards', all => 1
+);
+
+my @mails = RT::Test->fetch_caught_mails;
+is @mails, 1, "got a dashboard mail";
+
+# can't use parse_mail here is because it deletes all attachments
+# before we can call bodyhandle :/
+use RT::EmailParser;
+my $parser = RT::EmailParser->new;
+my $mail = $parser->ParseMIMEEntityFromScalar( $mails[0] );
+like(
+    $mail->head->get('Subject'),
+    qr/Daily Dashboard: dashboard foo/,
+    'mail subject'
+);
+
+my ($mail_image) = grep { $_->mime_type eq 'image/png' } $mail->parts;
+ok( $mail_image, 'mail contains image attachment' );
+
+my $handle = $mail_image->bodyhandle;
+
+my $mail_image_data = '';
+if ( my $io = $handle->open('r') ) {
+    while ( defined( $_ = $io->getline ) ) { $mail_image_data .= $_ }
+    $io->close;
+}
+is( $mail_image_data, $image, 'image in mail is the same one in web' );
+

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


More information about the Rt-commit mailing list