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
|
use strict;
use warnings;
use RT::Test::GnuPG
tests => 12,
gnupg_options => {
passphrase => 'recipient',
'trust-model' => 'always',
}
;
RT->Config->Get('Crypt')->{'AllowEncryptDataInDB'} = 1;
RT::Test->import_gnupg_key('general@example.com', 'public');
RT::Test->import_gnupg_key('general@example.com', 'secret');
my $queue = RT::Test->load_or_create_queue(
Name => 'General',
CorrespondAddress => 'general@example.com',
);
ok $queue && $queue->id, 'loaded or created queue';
{
my $ticket = RT::Test->create_ticket(
Queue => $queue->id,
Subject => 'test',
Content => 'test',
);
my $txn = $ticket->Transactions->First;
ok $txn && $txn->id, 'found first transaction';
is $txn->Type, 'Create', 'it is Create transaction';
my $attach = $txn->Attachments->First;
ok $attach && $attach->id, 'found attachment';
is $attach->Content, 'test', 'correct content';
my ($status, $msg) = $attach->Encrypt;
ok $status, 'encrypted attachment';
isnt $attach->Content, 'test', 'correct content';
($status, $msg) = $attach->Decrypt;
ok $status, 'decrypted attachment';
is $attach->Content, 'test', 'correct content';
}
|