summaryrefslogtreecommitdiff
path: root/rt/t/web/gnupg-select-keys-on-create.t
diff options
context:
space:
mode:
Diffstat (limited to 'rt/t/web/gnupg-select-keys-on-create.t')
-rw-r--r--rt/t/web/gnupg-select-keys-on-create.t47
1 files changed, 27 insertions, 20 deletions
diff --git a/rt/t/web/gnupg-select-keys-on-create.t b/rt/t/web/gnupg-select-keys-on-create.t
index e30b264..131f4c5 100644
--- a/rt/t/web/gnupg-select-keys-on-create.t
+++ b/rt/t/web/gnupg-select-keys-on-create.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test::GnuPG tests => 79, gnupg_options => { passphrase => 'rt-test' };
+use RT::Test::GnuPG tests => undef, gnupg_options => { passphrase => 'rt-test' };
use RT::Action::SendEmail;
my $queue = RT::Test->load_or_create_queue(
@@ -73,7 +73,7 @@ diag "check that things don't work if there is no key";
diag "import first key of rt-test\@example.com";
my $fpr1 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[0]{'TrustLevel'}, 0, 'is not trusted key';
$fpr1 = $res{'info'}[0]{'Fingerprint'};
@@ -122,7 +122,7 @@ diag "check that things still doesn't work if key is not trusted";
diag "import a second key of rt-test\@example.com";
my $fpr2 = '';
{
- RT::Test->import_gnupg_key('rt-test@example.com.2', 'public');
+ RT::Test->import_gnupg_key('rt-test@example.com.2', 'secret');
my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test@example.com' );
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
$fpr2 = $res{'info'}[2]{'Fingerprint'};
@@ -239,37 +239,44 @@ diag "check that key selector works and we can select trusted key";
}
diag "check encrypting of attachments";
-{
+for my $encrypt (0, 1) {
RT::Test->clean_caught_mails;
ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
$m->form_name('TicketCreate');
- $m->tick( Encrypt => 1 );
- $m->field( Requestors => 'rt-test@example.com' );
+ $m->tick( Encrypt => 1 ) if $encrypt;
+ $m->field( Requestors => '' );
+ $m->field( Cc => 'rt-test@example.com' );
$m->field( Content => 'Some content' );
$m->field( Attach => $0 );
$m->submit;
- $m->content_contains(
- 'You are going to encrypt outgoing email messages',
- 'problems with keys'
- );
- $m->content_contains(
- 'There are several keys suitable for encryption',
- 'problems with keys'
- );
- my $form = $m->form_name('TicketCreate');
- ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
- is scalar $input->possible_values, 2, 'two options';
+ if ($encrypt) {
+ $m->content_contains(
+ 'You are going to encrypt outgoing email messages',
+ 'problems with keys'
+ );
+ $m->content_contains(
+ 'There are several keys suitable for encryption',
+ 'problems with keys'
+ );
+
+ my $form = $m->form_name('TicketCreate');
+ ok my $input = $form->find_input( 'UseKey-rt-test@example.com' ), 'found key selector';
+ is scalar $input->possible_values, 2, 'two options';
+
+ $m->select( 'UseKey-rt-test@example.com' => $fpr1 );
+ $m->submit;
+ }
- $m->select( 'UseKey-rt-test@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 );
+ check_text_emails( { Encrypt => $encrypt, Attachment => "Attachment content" }, @mail );
$m->no_warnings_ok;
}
+undef $m;
+done_testing;