[Rt-commit] rt branch, gnupg-headers-fix, created. rt-4.0.1rc1-9-g8071fe9
? sunnavy
sunnavy at bestpractical.com
Wed Jun 8 04:00:28 EDT 2011
The branch, gnupg-headers-fix has been created
at 8071fe96d041120157c2093f4a66d5bd5b275e22 (commit)
- Log -----------------------------------------------------------------
commit d3341b787e3a734c441596b84ce621339f327851
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Jun 8 14:21:29 2011 +0800
values of X-RT-(Sign|Encrypt) are either 1 or 0, not ARRAY(...)
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 597f728..0b37786 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1291,9 +1291,8 @@ sub CreateTicket {
}
foreach my $argument (qw(Encrypt Sign)) {
- $MIMEObj->head->add(
- "X-RT-$argument" => Encode::encode_utf8( $ARGS{$argument} )
- ) if defined $ARGS{$argument};
+ $MIMEObj->head->replace( "X-RT-$argument" => $ARGS{$argument} ? 1 : 0 )
+ if defined $ARGS{$argument};
}
my %create_args = (
@@ -1526,8 +1525,8 @@ sub ProcessUpdateMessage {
}
my %message_args = (
- Sign => $args{ARGSRef}->{'Sign'},
- Encrypt => $args{ARGSRef}->{'Encrypt'},
+ Sign => ( $args{ARGSRef}->{'Sign'} ? 1 : 0 ),
+ Encrypt => ( $args{ARGSRef}->{'Encrypt'} ? 1 : 0 ),
MIMEObj => $Message,
TimeTaken => $args{ARGSRef}->{'UpdateTimeWorked'}
);
commit 8071fe96d041120157c2093f4a66d5bd5b275e22
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Jun 8 15:23:36 2011 +0800
X-RT-(Encrypt|Sign) tests
diff --git a/t/web/gnupg-headers.t b/t/web/gnupg-headers.t
new file mode 100644
index 0000000..88b3ab9
--- /dev/null
+++ b/t/web/gnupg-headers.t
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -w
+use strict;
+
+use RT::Test::GnuPG
+ tests => 15,
+ gnupg_options => {
+ passphrase => 'recipient',
+ 'trust-model' => 'always',
+ };
+
+RT::Test->import_gnupg_key( 'recipient at example.com', 'public' );
+RT::Test->import_gnupg_key( 'general at example.com', 'secret' );
+
+ok( my $user = RT::User->new( RT->SystemUser ) );
+ok( $user->Load('root'), "Loaded user 'root'" );
+$user->SetEmailAddress('recipient at example.com');
+
+my $queue = RT::Test->load_or_create_queue(
+ Name => 'General',
+ CorrespondAddress => 'general at example.com',
+);
+ok $queue && $queue->id, 'loaded or created queue';
+my $qid = $queue->id;
+
+my ( $baseurl, $m ) = RT::Test->started_ok;
+ok $m->login, 'logged in';
+
+diag "test with Encrypt and Sign disabled";
+
+$m->goto_create_ticket($queue);
+$m->form_name('TicketCreate');
+$m->field( 'Subject', 'Signing test' );
+$m->field( 'Content', 'Some other content' );
+$m->submit;
+$m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
+$m->follow_link_ok( { text => 'with headers' } );
+$m->content_contains('X-RT-Encrypt: 0');
+$m->content_contains('X-RT-Sign: 0');
+
+diag "test with Encrypt and Sign enabled";
+
+$m->goto_create_ticket($queue);
+$m->form_name('TicketCreate');
+$m->field( 'Subject', 'Signing test' );
+$m->field( 'Content', 'Some other content' );
+$m->tick( 'Encrypt', 1 );
+$m->tick( 'Sign', 1 );
+$m->submit;
+$m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
+$m->follow_link_ok( { text => 'with headers' } );
+$m->content_contains('X-RT-Encrypt: 1');
+$m->content_contains('X-RT-Sign: 1');
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list