[Rt-commit] r8948 - rt/branches/3.7-EXPERIMENTAL/t/web

ruz at bestpractical.com ruz at bestpractical.com
Wed Sep 5 22:56:26 EDT 2007


Author: ruz
Date: Wed Sep  5 22:56:26 2007
New Revision: 8948

Modified:
   rt/branches/3.7-EXPERIMENTAL/t/web/gnupg-outgoing.t

Log:
* add reply tests

Modified: rt/branches/3.7-EXPERIMENTAL/t/web/gnupg-outgoing.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/web/gnupg-outgoing.t	(original)
+++ rt/branches/3.7-EXPERIMENTAL/t/web/gnupg-outgoing.t	Wed Sep  5 22:56:26 2007
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 231;
+use Test::More tests => 428;
 use RT::Test;
 use RT::Action::SendEmail;
 use File::Temp qw(tempdir);
@@ -107,6 +107,7 @@
     }
 }
 
+# create a ticket for each combination
 foreach my $queue_set ( @variants ) {
     set_queue_crypt_options( %$queue_set );
     foreach my $ticket_set ( @variants ) {
@@ -114,6 +115,26 @@
     }
 }
 
+my $tid;
+{
+    my $ticket = RT::Ticket->new( $RT::SystemUser );
+    my ($tid) = $ticket->Create(
+        Subject   => 'test',
+        Queue     => $queue->id,
+        Requestor => 'rt-test at example.com',
+    );
+    ok $tid, 'ticket created';
+}
+
+# again for each combination add a reply message
+foreach my $queue_set ( @variants ) {
+    set_queue_crypt_options( %$queue_set );
+    foreach my $ticket_set ( @variants ) {
+        create_a_ticket( %$ticket_set );
+    }
+}
+
+
 # ------------------------------------------------------------------------------
 # now delete all keys from the keyring and put back secret/pub pair for rt-test@
 # and only public key for rt-recipient@ so we can verify signatures and decrypt
@@ -248,6 +269,40 @@
     $m->get_ok('/'); # ensure that the mail has been processed
 
     my @mail = RT::Test->fetch_caught_mails;
+    check_text_emails( \%args, @mail );
+}
+
+sub update_ticket {
+    my %args = (@_);
+
+    # cleanup mail catcher's storage
+    unlink "t/mailbox";
+
+    $m->goto_ticket( $tid );
+    $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
+    $m->form_number(3);
+    $m->field( UpdateContent => 'Some content' );
+
+    foreach ( qw(Sign Encrypt) ) {
+        if ( $args{ $_ } ) {
+            $m->tick( $_ => 1 );
+        } else {
+            $m->untick( $_ => 1 );
+        }
+    }
+
+    $m->submit;
+    is $m->status, 200, "request successful";
+    $m->get_ok('/'); # ensure that the mail has been processed
+
+    my @mail = RT::Test->fetch_caught_mails;
+    check_text_emails( \%args, @mail );
+}
+
+sub check_text_emails {
+    my %args = %{ shift @_ };
+    my @mail = @_;
+
     ok scalar @mail, "got some mail";
     for my $mail (@mail) {
         if ( $args{'Encrypt'} ) {


More information about the Rt-commit mailing list