summaryrefslogtreecommitdiff
path: root/rt/t/crypt/gnupg/attachments-in-db.t
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-07-09 22:18:55 -0700
committerIvan Kohler <ivan@freeside.biz>2015-07-09 22:18:55 -0700
commit1c538bfabc2cd31f27067505f0c3d1a46cba6ef0 (patch)
tree96922ad4459eda1e649327fd391d60c58d454c53 /rt/t/crypt/gnupg/attachments-in-db.t
parent4f5619288413a185e9933088d9dd8c5afbc55dfa (diff)
RT 4.2.11, ticket#13852
Diffstat (limited to 'rt/t/crypt/gnupg/attachments-in-db.t')
-rw-r--r--rt/t/crypt/gnupg/attachments-in-db.t49
1 files changed, 49 insertions, 0 deletions
diff --git a/rt/t/crypt/gnupg/attachments-in-db.t b/rt/t/crypt/gnupg/attachments-in-db.t
new file mode 100644
index 0000000..1a377c3
--- /dev/null
+++ b/rt/t/crypt/gnupg/attachments-in-db.t
@@ -0,0 +1,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';
+}
+
+
+