[Rt-commit] r9077 - in rtir/branches/2.3-EXPERIMENTAL: .
sartak at bestpractical.com
sartak at bestpractical.com
Mon Sep 17 16:55:57 EDT 2007
Author: sartak
Date: Mon Sep 17 16:55:54 2007
New Revision: 9077
Modified:
rtir/branches/2.3-EXPERIMENTAL/ (props changed)
rtir/branches/2.3-EXPERIMENTAL/t/021-gnupg.t
Log:
r42768 at onn: sartak | 2007-09-17 16:55:49 -0400
Add tests for adding an attachment, they pass :)
Modified: rtir/branches/2.3-EXPERIMENTAL/t/021-gnupg.t
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/t/021-gnupg.t (original)
+++ rtir/branches/2.3-EXPERIMENTAL/t/021-gnupg.t Mon Sep 17 16:55:54 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 44;
+use Test::More tests => 55;
use File::Temp qw(tempdir);
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
@@ -252,23 +252,67 @@
check_text_emails( { Encrypt => 1 }, @mail );
}
+diag "check encrypting of attachments";
+{
+ unlink "t/mailbox";
+
+ ok $agent->goto_create_ticket( $queue ), "UI -> create ticket";
+ $agent->form_number(3);
+ $agent->tick( Encrypt => 1 );
+ $agent->field( Requestors => 'rt-test at example.com' );
+ $agent->field( Content => 'Some content' );
+ $agent->field( Attachment => $0 );
+ $agent->submit;
+ $agent->content_like(
+ qr/You are going to encrypt outgoing email messages/i,
+ 'problems with keys'
+ );
+ $agent->content_like(
+ qr/There are several keys suitable for encryption/i,
+ 'problems with keys'
+ );
+
+ my $form = $agent->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';
+
+ $agent->select( 'UseKey-rt-test at example.com' => $fpr1 );
+ $agent->click('Create');
+ $agent->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