[Rt-commit] r13733 - in rt/3.8/trunk: . t/web

clkao at bestpractical.com clkao at bestpractical.com
Wed Jul 2 17:06:36 EDT 2008


Author: clkao
Date: Wed Jul  2 17:06:35 2008
New Revision: 13733

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/lib/RT/Test.pm
   rt/3.8/trunk/t/web/crypt-gnupg.t
   rt/3.8/trunk/t/web/gnupg-outgoing.t
   rt/3.8/trunk/t/web/gnupg-select-keys-on-create.t
   rt/3.8/trunk/t/web/gnupg-select-keys-on-update.t

Log:
 r31979 at mtl:  clkao | 2008-07-02 19:05:29 +0100
 Make the gpg tests parallelizable by fixing the hardcoded t/mailbox
 used in the tests.
 


Modified: rt/3.8/trunk/lib/RT/Test.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Test.pm	(original)
+++ rt/3.8/trunk/lib/RT/Test.pm	Wed Jul  2 17:06:35 2008
@@ -544,13 +544,14 @@
     return ($status, $id);
 }
 
+my $mailbox_catcher = File::Temp->new( OPEN => 0, CLEANUP => 0 )->filename;
 sub set_mail_catcher {
     my $self = shift;
     my $catcher = sub {
         my $MIME = shift;
 
-        open my $handle, '>>', 't/mailbox'
-            or die "Unable to open t/mailbox for appending: $!";
+        open my $handle, '>>', $mailbox_catcher
+            or die "Unable to open $mailbox_catcher for appending: $!";
 
         $MIME->print($handle);
         print $handle "%% split me! %%\n";
@@ -562,7 +563,11 @@
 sub fetch_caught_mails {
     my $self = shift;
     return grep /\S/, split /%% split me! %%/,
-        RT::Test->file_content( 't/mailbox', 'unlink' => 1, noexist => 1 );
+        RT::Test->file_content( $mailbox_catcher, 'unlink' => 1, noexist => 1 );
+}
+
+sub clean_caught_mails {
+    unlink $mailbox_catcher;
 }
 
 sub file_content {
@@ -570,7 +575,7 @@
     my $path = shift;
     my %args = @_;
 
-    $path = File::Spec->catfile( @$path ) if ref $path;
+    $path = File::Spec->catfile( @$path ) if ref $path eq 'ARRAY';
 
     diag "reading content of '$path'" if $ENV{'TEST_VERBOSE'};
 

Modified: rt/3.8/trunk/t/web/crypt-gnupg.t
==============================================================================
--- rt/3.8/trunk/t/web/crypt-gnupg.t	(original)
+++ rt/3.8/trunk/t/web/crypt-gnupg.t	Wed Jul  2 17:06:35 2008
@@ -79,7 +79,7 @@
 $m->field(Encrypt => 1);
 $m->submit;
 
-unlink "t/mailbox";
+RT::Test->clean_caught_mails;
 
 $m->goto_create_ticket( $queue );
 $m->form_name('TicketCreate');
@@ -148,7 +148,7 @@
 $m->field(Sign => 1);
 $m->submit;
 
-unlink "t/mailbox";
+RT::Test->clean_caught_mails;
 
 $m->goto_create_ticket( $queue );
 $m->form_name('TicketCreate');
@@ -220,7 +220,8 @@
 $m->field(Sign => 1);
 $m->submit;
 
-unlink "t/mailbox";
+RT::Test->clean_caught_mails;
+
 
 $m->goto_create_ticket( $queue );
 $m->form_name('TicketCreate');
@@ -285,7 +286,7 @@
     like($attachments[0]->Content, qr/$RT::rtname/, "RT's mail includes this instance's name");
 }
 
-unlink "t/mailbox";
+RT::Test->clean_caught_mails;
 
 $m->goto_create_ticket( $queue );
 $m->form_name('TicketCreate');

Modified: rt/3.8/trunk/t/web/gnupg-outgoing.t
==============================================================================
--- rt/3.8/trunk/t/web/gnupg-outgoing.t	(original)
+++ rt/3.8/trunk/t/web/gnupg-outgoing.t	Wed Jul  2 17:06:35 2008
@@ -255,8 +255,7 @@
 sub create_a_ticket {
     my %args = (@_);
 
-    # cleanup mail catcher's storage
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     $m->goto_create_ticket( $queue );
     $m->form_name('TicketCreate');
@@ -287,8 +286,7 @@
     my $tid = shift;
     my %args = (@_);
 
-    # cleanup mail catcher's storage
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );

Modified: rt/3.8/trunk/t/web/gnupg-select-keys-on-create.t
==============================================================================
--- rt/3.8/trunk/t/web/gnupg-select-keys-on-create.t	(original)
+++ rt/3.8/trunk/t/web/gnupg-select-keys-on-create.t	Wed Jul  2 17:06:35 2008
@@ -53,7 +53,7 @@
 
 diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -79,7 +79,7 @@
 
 diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -114,7 +114,7 @@
 
 diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -161,7 +161,7 @@
 
 diag "check that things still doesn't work if two keys are not trusted" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -206,7 +206,7 @@
 
 diag "check that we see key selector even if only one key is trusted but there are more keys";
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -233,7 +233,7 @@
 
 diag "check that key selector works and we can select trusted key";
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -265,7 +265,7 @@
 
 diag "check encrypting of attachments";
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);

Modified: rt/3.8/trunk/t/web/gnupg-select-keys-on-update.t
==============================================================================
--- rt/3.8/trunk/t/web/gnupg-select-keys-on-update.t	(original)
+++ rt/3.8/trunk/t/web/gnupg-select-keys-on-update.t	Wed Jul  2 17:06:35 2008
@@ -64,7 +64,7 @@
 
 diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -91,7 +91,7 @@
 
 diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -128,7 +128,7 @@
 
 diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -176,7 +176,7 @@
 
 diag "check that things still doesn't work if two keys are not trusted" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -222,7 +222,7 @@
 
 diag "check that we see key selector even if only one key is trusted but there are more keys" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -250,7 +250,7 @@
 
 diag "check that key selector works and we can select trusted key" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -283,7 +283,7 @@
 
 diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
 {
-    unlink "t/mailbox";
+    RT::Test->clean_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );


More information about the Rt-commit mailing list