[Rt-commit] r8843 - rt/branches/3.7-EXPERIMENTAL/t/mail
ruz at bestpractical.com
ruz at bestpractical.com
Thu Aug 30 17:20:10 EDT 2007
Author: ruz
Date: Thu Aug 30 17:20:10 2007
New Revision: 8843
Modified:
rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t
Log:
* use nice functions from RT::Tests to do common things
* now all our messages use the same format, without exceptions
Modified: rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t (original)
+++ rt/branches/3.7-EXPERIMENTAL/t/mail/gnupg-realmail.t Thu Aug 30 17:20:10 2007
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 176;
+use Test::More tests => 177;
use File::Temp;
use RT::Test;
use Cwd 'getcwd';
@@ -24,20 +24,26 @@
RT->Config->Set( 'MailPlugins' => 'Auth::MailFrom', 'Auth::GnuPG' );
my ($baseurl, $m) = RT::Test->started_ok;
-
-$m->get( $baseurl."?user=root;pass=password" );
-$m->content_like(qr/Logout/, 'we did log in');
-$m->get( $baseurl.'/Admin/Queues/');
+ok $m->login, 'we did log in';
+$m->get_ok( '/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('ternus at mit.edu');
+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,
+ Right => ['CreateTicket'],
+);
-my %body = (1 => qr/This is a test email with MIME signature./);
my $eid = 0;
for my $usage (qw/signed encrypted signed&encrypted/) {
@@ -99,8 +105,7 @@
"$eid: recorded incoming mail that is encrypted"
);
- like( $attachments[0]->Content,
- ($body{$eid} || qr/ID:$eid/),
+ like( $attachments[0]->Content, qr/ID:$eid/,
"$eid: incoming mail did NOT have original body"
);
}
@@ -109,8 +114,7 @@
'Not encrypted',
"$eid: recorded incoming mail that is not encrypted"
);
- like( $msg->Content || $attachments[0]->Content,
- ($body{$eid} || qr/ID:$eid/),
+ like( $msg->Content || $attachments[0]->Content, qr/ID:$eid/,
"$eid: got original content"
);
}
More information about the Rt-commit
mailing list