X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Ft%2Fmail%2Fgnupg-realmail.t;h=834014ccc69905b9513b70c68f079a7059ff7cf8;hb=919e930aa9279b3c5cd12b593889cd6de79d67bf;hp=198402b23d6558dbea28e0783cac7056f71c32da;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/rt/t/mail/gnupg-realmail.t b/rt/t/mail/gnupg-realmail.t index 198402b23..834014ccc 100644 --- a/rt/t/mail/gnupg-realmail.t +++ b/rt/t/mail/gnupg-realmail.t @@ -1,33 +1,13 @@ -#!/usr/bin/perl use strict; use warnings; -use RT::Test tests => 196; - -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 RT::Test::GnuPG tests => 198, gnupg_options => { passphrase => 'rt-test' }; use Digest::MD5 qw(md5_hex); -use File::Temp qw(tempdir); -my $homedir = tempdir( CLEANUP => 1 ); - -RT->Config->Set( 'GnuPG', - Enable => 1, - OutgoingMessagesFormat => 'RFC' ); - -RT->Config->Set( 'GnuPGOptions', - homedir => $homedir, - passphrase => 'rt-test', - 'no-permission-warning' => undef); - -RT->Config->Set( 'MailPlugins' => 'Auth::MailFrom', 'Auth::GnuPG' ); - RT::Test->import_gnupg_key('rt-recipient@example.com'); RT::Test->import_gnupg_key('rt-test@example.com', 'public'); +RT::Test->trust_gnupg_key('rt-test@example.com'); my ($baseurl, $m) = RT::Test->started_ok; ok $m->login, 'we did log in'; @@ -37,17 +17,12 @@ $m->submit_form( form_number => 3, fields => { CorrespondAddress => 'rt-recipient@example.com' } ); $m->content_like(qr/rt-recipient\@example.com.* - never/, 'has key info.'); -RT::Test->set_rights( - Principal => 'Everyone', - Right => ['CreateTicket'], -); - my $eid = 0; for my $usage (qw/signed encrypted signed&encrypted/) { for my $format (qw/MIME inline/) { for my $attachment (qw/plain text-attachment binary-attachment/) { ++$eid; - diag "Email $eid: $usage, $attachment email with $format format" if $ENV{TEST_VERBOSE}; + diag "Email $eid: $usage, $attachment email with $format format"; eval { email_ok($eid, $usage, $format, $attachment) }; } } @@ -57,13 +32,13 @@ $eid = 18; { my ($usage, $format, $attachment) = ('signed', 'inline', 'plain'); ++$eid; - diag "Email $eid: $usage, $attachment email with $format format" if $ENV{TEST_VERBOSE}; + diag "Email $eid: $usage, $attachment email with $format format"; eval { email_ok($eid, $usage, $format, $attachment) }; } sub email_ok { my ($eid, $usage, $format, $attachment) = @_; - diag "email_ok $eid: $usage, $format, $attachment" if $ENV{'TEST_VERBOSE'}; + diag "email_ok $eid: $usage, $format, $attachment"; my $emaildatadir = RT::Test::get_relocatable_dir(File::Spec->updir(), qw(data gnupg emails)); @@ -74,7 +49,7 @@ sub email_ok { is ($status >> 8, 0, "$eid: The mail gateway exited normally"); ok ($id, "$eid: got id of a newly created ticket - $id"); - my $tick = RT::Ticket->new( $RT::SystemUser ); + my $tick = RT::Ticket->new( RT->SystemUser ); $tick->Load( $id ); ok ($tick->id, "$eid: loaded ticket #$id");