4 use RT::Test::SMIME tests => undef;
7 use String::ShellQuote 'shell_quote';
10 RT->Config->Get('Crypt')->{'AllowEncryptDataInDB'} = 1;
12 RT::Test::SMIME->import_key('sender@example.com');
13 my $queue = RT::Test->load_or_create_queue(
15 CorrespondAddress => 'sender@example.com',
17 ok $queue && $queue->id, 'loaded or created queue';
20 my $ticket = RT::Test->create_ticket(
26 my $txn = $ticket->Transactions->First;
27 ok $txn && $txn->id, 'found first transaction';
28 is $txn->Type, 'Create', 'it is Create transaction';
30 my $attach = $txn->Attachments->First;
31 ok $attach && $attach->id, 'found attachment';
32 is $attach->Content, 'test', 'correct content';
34 my ($status, $msg) = $attach->Encrypt;
35 ok $status, 'encrypted attachment' or diag "error: $msg";
37 isnt $attach->Content, 'test', 'correct content';
39 ($status, $msg) = $attach->Decrypt;
40 ok $status, 'decrypted attachment' or diag "error: $msg";
42 is $attach->Content, 'test', 'correct content';