[Rt-commit] r9078 - in rt/branches/3.7-EXPERIMENTAL: .
sartak at bestpractical.com
sartak at bestpractical.com
Mon Sep 17 17:01:12 EDT 2007
Author: sartak
Date: Mon Sep 17 17:01:11 2007
New Revision: 9078
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/t/web/gnupg-select-keys-on-create.t
Log:
r42771 at onn: sartak | 2007-09-17 17:01:05 -0400
Backport attachment tests from RTIR
Modified: rt/branches/3.7-EXPERIMENTAL/t/web/gnupg-select-keys-on-create.t
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/t/web/gnupg-select-keys-on-create.t (original)
+++ rt/branches/3.7-EXPERIMENTAL/t/web/gnupg-select-keys-on-create.t Mon Sep 17 17:01:11 2007
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 46;
+use Test::More tests => 57;
use RT::Test;
use RT::Action::SendEmail;
use File::Temp qw(tempdir);
@@ -236,23 +236,67 @@
check_text_emails( { Encrypt => 1 }, @mail );
}
+diag "check encrypting of attachments";
+{
+ unlink "t/mailbox";
+
+ ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
+ $m->form_number(3);
+ $m->tick( Encrypt => 1 );
+ $m->field( Requestors => 'rt-test at example.com' );
+ $m->field( Content => 'Some content' );
+ $m->field( Attach => $0 );
+ $m->submit;
+ $m->content_like(
+ qr/You are going to encrypt outgoing email messages/i,
+ 'problems with keys'
+ );
+ $m->content_like(
+ qr/There are several keys suitable for encryption/i,
+ 'problems with keys'
+ );
+
+ my $form = $m->form_number(3);
+ ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+ is scalar $input->possible_values, 2, 'two options';
+
+ $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
+ $m->submit;
+ $m->content_like( qr/Ticket \d+ created in queue/i, 'ticket created' );
+
+ my @mail = RT::Test->fetch_caught_mails;
+ ok @mail, 'there are some emails';
+ check_text_emails( { Encrypt => 1, Attachment => 1 }, @mail );
+}
+
sub check_text_emails {
my %args = %{ shift @_ };
my @mail = @_;
ok scalar @mail, "got some mail";
for my $mail (@mail) {
- if ( $args{'Encrypt'} ) {
- unlike $mail, qr/Some content/, "outgoing email was encrypted";
- } else {
- like $mail, qr/Some content/, "outgoing email was not encrypted";
- }
- if ( $args{'Sign'} && $args{'Encrypt'} ) {
- like $mail, qr/BEGIN PGP MESSAGE/, 'outgoing email was signed';
- } elsif ( $args{'Sign'} ) {
- like $mail, qr/SIGNATURE/, 'outgoing email was signed';
- } else {
- unlike $mail, qr/SIGNATURE/, 'outgoing email was not signed';
+ for my $type ('email', 'attachment') {
+ next if $type eq 'attachment' && !$args{'Attachment'};
+
+ my $content = $type eq 'email'
+ ? "Some content"
+ : "Attachment content";
+
+ if ( $args{'Encrypt'} ) {
+ unlike $mail, qr/$content/, "outgoing $type was encrypted";
+ } else {
+ like $mail, qr/$content/, "outgoing $type was not encrypted";
+ }
+
+ next unless $type eq 'email';
+
+ if ( $args{'Sign'} && $args{'Encrypt'} ) {
+ like $mail, qr/BEGIN PGP MESSAGE/, 'outgoing email was signed';
+ } elsif ( $args{'Sign'} ) {
+ like $mail, qr/SIGNATURE/, 'outgoing email was signed';
+ } else {
+ unlike $mail, qr/SIGNATURE/, 'outgoing email was not signed';
+ }
}
}
}
More information about the Rt-commit
mailing list