[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-78-gef7a0ec

Ruslan Zakirov ruz at bestpractical.com
Mon Jun 7 11:23:19 EDT 2010


The branch, 3.8-trunk has been updated
       via  ef7a0ec41559833cc6126429d9367071d60830f3 (commit)
       via  ff38e3be025d776a4204c80fc3c86445f427b3eb (commit)
      from  73756bbb6ce3e925713b03d783847f1f2f3db3c6 (commit)

Summary of changes:
 .../emails/special/quoted_inline_signature.txt     |   26 ++++++
 t/mail/gnupg-incoming.t                            |    3 +-
 t/mail/gnupg-realmail.t                            |   13 +---
 t/mail/gnupg-special.t                             |   86 ++++++++++++++++++++
 4 files changed, 115 insertions(+), 13 deletions(-)
 create mode 100644 t/data/gnupg/emails/special/quoted_inline_signature.txt
 create mode 100644 t/mail/gnupg-special.t

- Log -----------------------------------------------------------------
commit ff38e3be025d776a4204c80fc3c86445f427b3eb
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Jun 7 16:24:10 2010 +0400

    new gnupg tests to check special cases and regressions

diff --git a/t/data/gnupg/emails/special/quoted_inline_signature.txt b/t/data/gnupg/emails/special/quoted_inline_signature.txt
new file mode 100644
index 0000000..131d27a
--- /dev/null
+++ b/t/data/gnupg/emails/special/quoted_inline_signature.txt
@@ -0,0 +1,26 @@
+To: rt-recipient at example.com
+Subject: Test Email ID:4
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+Content-Disposition: inline
+From: root at localhost
+
+Forwarded email with signature quoted. RT shouldn't bother
+about it.
+
+> ------ Forwarded Message
+> From: Xxx Yyy <xxx.yyy at localhost>
+> Subject: test email
+> 
+> -----BEGIN PGP SIGNED MESSAGE-----
+> Hash: SHA1
+> 
+> This is a test email with inline signature.
+> ID:4
+> -----BEGIN PGP SIGNATURE-----
+> Version: GnuPG v1.4.6 (GNU/Linux)
+> 
+> iD8DBQFGwLI50ygDXYSIHxsRAp40AJ9ErYdLH2SVRXtgRtx7n/FVFOmKDwCgl/0T
+> BeRSaF4Xbi8uGhVIkmU+YCs=
+> =e4u6
+> -----END PGP SIGNATURE-----
diff --git a/t/mail/gnupg-special.t b/t/mail/gnupg-special.t
new file mode 100644
index 0000000..7e50819
--- /dev/null
+++ b/t/mail/gnupg-special.t
@@ -0,0 +1,86 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use RT::Test tests => 11;
+
+plan skip_all => 'GnuPG required.'
+    unless eval 'use GnuPG::Interface; 1';
+plan skip_all => 'gpg executable is required.'
+    unless RT::Test->find_executable('gpg');
+
+use File::Temp qw(tempdir);
+my $homedir = tempdir( CLEANUP => 1 );
+
+# catch any outgoing emails
+RT::Test->set_mail_catcher;
+
+RT->Config->Set( 'GnuPG',
+                 Enable => 1,
+                 OutgoingMessagesFormat => 'RFC' );
+
+RT->Config->Set( 'GnuPGOptions',
+                 homedir => $homedir,
+                 'no-permission-warning' => undef);
+
+RT->Config->Set( 'MailPlugins' => 'Auth::MailFrom', 'Auth::GnuPG' );
+
+RT::Test->import_gnupg_key('rt-recipient at example.com');
+RT::Test->import_gnupg_key('rt-test at example.com', 'public');
+
+my ($baseurl, $m) = RT::Test->started_ok;
+
+ok( $m->login, 'we did log in' );
+
+# configure key for General queue
+{
+    $m->get( $baseurl.'/Admin/Queues/');
+    $m->follow_link_ok( {text => 'General'} );
+    $m->submit_form(
+        form_number => 3,
+        fields      => { CorrespondAddress => 'rt-recipient at example.com' },
+    );
+    $m->content_like(qr/rt-recipient\@example.com.* - never/, 'has key info.');
+}
+
+ok(my $user = RT::User->new($RT::SystemUser));
+ok($user->Load('root'), "Loaded user 'root'");
+$user->SetEmailAddress('recipient at example.com');
+
+RT::Test->set_rights(
+    Principal => 'Everyone',
+    Right => ['CreateTicket'],
+);
+
+{
+    my $id = send_via_mailgate('quoted_inline_signature.txt');
+
+    my $tick = RT::Ticket->new( $RT::SystemUser );
+    $tick->Load( $id );
+    ok ($tick->id, "loaded ticket #$id");
+
+    my $txn = $tick->Transactions->First;
+    my ($msg, @attachments) = @{$txn->Attachments->ItemsArrayRef};
+
+    is( $msg->GetHeader('X-RT-Privacy'),
+        undef,
+        "no privacy is set as this ticket is not encrypted"
+    );
+
+    my @mail = RT::Test->fetch_caught_mails;
+    is(scalar @mail, 1, "autoreply only");
+}
+
+sub send_via_mailgate {
+    my $fname = shift;
+    my $emaildatadir = RT::Test::get_relocatable_dir(File::Spec->updir(),
+        qw(data gnupg emails special));
+    my $file = File::Spec->catfile( $emaildatadir, $fname );
+    my $mail = RT::Test->file_content($file);
+
+    my ($status, $id) = RT::Test->send_via_mailgate($mail);
+    is ($status >> 8, 0, "the mail gateway exited normally");
+    ok ($id, "got id of a newly created ticket - $id");
+    return $id;
+}
+

commit ef7a0ec41559833cc6126429d9367071d60830f3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Jun 7 16:24:38 2010 +0400

    minor test cleanups to use API

diff --git a/t/mail/gnupg-incoming.t b/t/mail/gnupg-incoming.t
index ec31333..230aa9c 100644
--- a/t/mail/gnupg-incoming.t
+++ b/t/mail/gnupg-incoming.t
@@ -34,8 +34,7 @@ RT->Config->Set( 'MailPlugins' => 'Auth::MailFrom', 'Auth::GnuPG' );
 my ($baseurl, $m) = RT::Test->started_ok;
 
 # configure key for General queue
-$m->get( $baseurl."?user=root;pass=password" );
-$m->content_like(qr/Logout/, 'we did log in');
+ok( $m->login, 'we did log in' );
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );
 $m->submit_form( form_number => 3,
diff --git a/t/mail/gnupg-realmail.t b/t/mail/gnupg-realmail.t
index de1d958..198402b 100644
--- a/t/mail/gnupg-realmail.t
+++ b/t/mail/gnupg-realmail.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 197;
+use RT::Test tests => 196;
 
 plan skip_all => 'GnuPG required.'
     unless eval 'use GnuPG::Interface; 1';
@@ -37,20 +37,11 @@ $m->submit_form( form_number => 3,
          fields      => { CorrespondAddress => 'rt-recipient at example.com' } );
 $m->content_like(qr/rt-recipient\@example.com.* - never/, 'has key info.');
 
-diag "load Everyone group" if $ENV{'TEST_VERBOSE'};
-my $everyone;
-{
-    $everyone = RT::Group->new( $RT::SystemUser );
-    $everyone->LoadSystemInternalGroup('Everyone');
-    ok $everyone->id, "loaded 'everyone' group";
-}
-
 RT::Test->set_rights(
-    Principal => $everyone,
+    Principal => 'Everyone',
     Right => ['CreateTicket'],
 );
 
-
 my $eid = 0;
 for my $usage (qw/signed encrypted signed&encrypted/) {
     for my $format (qw/MIME inline/) {

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


More information about the Rt-commit mailing list