1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/usr/bin/perl -w
use strict;
use warnings;
use RT::Test::GnuPG tests => 22, gnupg_options => { passphrase => 'rt-test' };
use RT::Action::SendEmail;
RT::Test->import_gnupg_key('rt-recipient@example.com');
RT::Test->import_gnupg_key('rt-test@example.com', 'public');
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
CorrespondAddress => 'rt-recipient@example.com',
CommentAddress => 'rt-recipient@example.com',
);
ok $queue && $queue->id, 'loaded or created queue';
my ($baseurl, $m) = RT::Test->started_ok;
ok $m->login, 'logged in';
my @variants = (
{},
{ Sign => 1 },
{ Encrypt => 1 },
{ Sign => 1, Encrypt => 1 },
);
# collect emails
my %mail = (
plain => [],
signed => [],
encrypted => [],
signed_encrypted => [],
);
diag "check in read-only mode that queue's props influence create/update ticket pages";
{
foreach my $variant ( @variants ) {
set_queue_crypt_options( $queue => %$variant );
$m->goto_create_ticket( $queue );
$m->form_name('TicketCreate');
if ( $variant->{'Encrypt'} ) {
ok $m->value('Encrypt', 2), "encrypt tick box is checked";
} else {
ok !$m->value('Encrypt', 2), "encrypt tick box is unchecked";
}
if ( $variant->{'Sign'} ) {
ok $m->value('Sign', 2), "sign tick box is checked";
} else {
ok !$m->value('Sign', 2), "sign tick box is unchecked";
}
}
# to avoid encryption/signing during create
set_queue_crypt_options($queue);
my $ticket = RT::Ticket->new( RT->SystemUser );
my ($id) = $ticket->Create(
Subject => 'test',
Queue => $queue->id,
Requestor => 'rt-test@example.com',
);
ok $id, 'ticket created';
foreach my $variant ( @variants ) {
set_queue_crypt_options( $queue => %$variant );
$m->get( $m->rt_base_url . "/Ticket/Update.html?Action=Respond&id=$id" );
$m->form_name('TicketUpdate');
if ( $variant->{'Encrypt'} ) {
ok $m->value('Encrypt', 2), "encrypt tick box is checked";
} else {
ok !$m->value('Encrypt', 2), "encrypt tick box is unchecked";
}
if ( $variant->{'Sign'} ) {
ok $m->value('Sign', 2), "sign tick box is checked";
} else {
ok !$m->value('Sign', 2), "sign tick box is unchecked";
}
}
}
|