[Rt-commit] rt branch, 3.999-trunk, updated. 253eb19ea1ecf029cb169602530541238ebaedd6

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Nov 6 02:05:28 EST 2009


The branch, 3.999-trunk has been updated
       via  253eb19ea1ecf029cb169602530541238ebaedd6 (commit)
      from  2d829f9e24074edc8540abc682e2a055394041bc (commit)

Summary of changes:
 t/mail/gateway.t                    |   19 ++++++++++++++++---
 t/web/crypt-gnupg.t                 |    6 ++++--
 t/web/gnupg-select-keys-on-create.t |    5 +++--
 t/web/gnupg-select-keys-on-update.t |    5 +++--
 4 files changed, 26 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit 253eb19ea1ecf029cb169602530541238ebaedd6
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Nov 6 15:05:07 2009 +0800

    catch warnings in tests

diff --git a/t/mail/gateway.t b/t/mail/gateway.t
index c0c0ec2..7eda457 100644
--- a/t/mail/gateway.t
+++ b/t/mail/gateway.t
@@ -56,9 +56,10 @@ rt-mailgate - Mail interface to RT3.
 use strict;
 use warnings;
 
-use RT::Test strict => 0, tests => 159;
+use RT::Test strict => 1, tests => 169;
 
 my ($baseurl, $ua) = RT::Test->started_ok;
+ok( $ua->login, 'logged in' );
 
 use RT::Model::TicketCollection;
 
@@ -105,7 +106,6 @@ EOF
     is ($status >> 8, 75, "The mail gateway exited with a failure");
     ok (!$id, "No ticket id");
 }
-
 my $everyone_group;
 diag "revoke rights tests depend on" if $ENV{'TEST_VERBOSE'};
 {
@@ -254,6 +254,11 @@ EOF
     ok( !$u->id, "user does not exist and was not Created by failed ticket submission");
 }
 
+$ua->warnings_like(
+    [(qr/could not load a valid user/i) x 3],
+    'got could not load user warning'
+);
+
 diag "grant everybody with CreateTicket right" if $ENV{'TEST_VERBOSE'};
 {
     ok( RT::Test->set_rights(
@@ -309,6 +314,11 @@ EOF
     ok( !$u->id, " user does not exist and was not Created by ticket correspondence submission");
 }
 
+$ua->warnings_like(
+    [(qr/could not load a valid user/i) x 3],
+    'got could not load user warning'
+);
+
 diag "grant everyone 'ReplyToTicket' right" if $ENV{'TEST_VERBOSE'};
 {
     ok( RT::Test->set_rights(
@@ -388,6 +398,10 @@ EOF
     ok( !$u->id, " user does not exist and was not Created by ticket comment submission");
 }
 
+$ua->warnings_like(
+    [(qr/could not load a valid user/i) x 3],
+    'got could not load user warning'
+);
 
 diag "grant everyone 'CommentOnTicket' right" if $ENV{'TEST_VERBOSE'};
 {
@@ -509,7 +523,6 @@ diag "Testing preservation of binary attachments" if $ENV{'TEST_VERBOSE'};
     # Grab the binary attachment via the web ui
     my $full_url = "$url/Ticket/Attachment/". $attachment->transaction_id
         ."/". $attachment->id. "/bplogo.gif";
-        $ua->login();
     my $r = $ua->get( $full_url );
 
     # Verify that the downloaded attachment is the same as what we uploaded.
diff --git a/t/web/crypt-gnupg.t b/t/web/crypt-gnupg.t
index af37edd..3f8af4a 100644
--- a/t/web/crypt-gnupg.t
+++ b/t/web/crypt-gnupg.t
@@ -2,14 +2,14 @@
 use strict;
 
 use Test::More;
-use RT::Test strict => 0;
+use RT::Test strict => 1;
 
 plan skip_all => 'GnuPG required.'
     unless eval 'use GnuPG::Interface; 1';
 plan skip_all => 'gpg executable is required.'
     unless RT::Test->find_executable('gpg');
 
-plan tests => 92;
+plan tests => 93;
 
 use RT::ScripAction::SendEmail;
 
@@ -388,6 +388,8 @@ hello
 MAIL
  
 ((my $status), $id) = RT::Test->send_via_mailgate($mail);
+$m->warnings_like( qr/Recipient 'nokey\@example.com' is unusable/ );
+
 is ($status >> 8, 0, "The mail gateway exited normally");
 ok ($id, "got id of a newly created ticket - $id");
 $tick = RT::Model::Ticket->new(current_user => RT->system_user );
diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index 8fd10bb..d14094c 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -3,14 +3,14 @@ use strict;
 use warnings;
 
 use Test::More;
-use RT::Test strict => 0;
+use RT::Test strict => 1;
 
 plan skip_all => 'GnuPG required.'
     unless eval 'use GnuPG::Interface; 1';
 plan skip_all => 'gpg executable is required.'
     unless RT::Test->find_executable('gpg');
 
-plan tests => 60;
+plan tests => 61;
 
 use RT::ScripAction::SendEmail;
 use File::Temp qw(tempdir);
@@ -66,6 +66,7 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
         qr/unable to sign outgoing email messages/i,
         'problems with passphrase'
     );
+    $m->warnings_like( qr/secret key not available/, 'got secret key not available warning' );
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
diff --git a/t/web/gnupg-select-keys-on-update.t b/t/web/gnupg-select-keys-on-update.t
index cd836eb..df115cd 100644
--- a/t/web/gnupg-select-keys-on-update.t
+++ b/t/web/gnupg-select-keys-on-update.t
@@ -3,14 +3,14 @@ use strict;
 use warnings;
 
 use Test::More;
-use RT::Test strict => 0;
+use RT::Test strict => 1;
 
 plan skip_all => 'GnuPG required.'
     unless eval 'use GnuPG::Interface; 1';
 plan skip_all => 'gpg executable is required.'
     unless RT::Test->find_executable('gpg');
 
-plan tests => 68;
+plan tests => 69;
 
 use RT::ScripAction::SendEmail;
 use File::Temp qw(tempdir);
@@ -78,6 +78,7 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
         qr/unable to sign outgoing email messages/i,
         'problems with passphrase'
     );
+    $m->warnings_like( qr/secret key not available/, 'got secret key not available warning' );
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';

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


More information about the Rt-commit mailing list