X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rt%2Flib%2FRT%2FTest%2FGnuPG.pm;h=fc162aa84e7c2edd69231318ec7a09ef21d70391;hb=187086c479a09629b7d180eec513fb7657f4e291;hp=e5a08b75a1072fc4a5674508764eb5ee083c99e3;hpb=7322f2afedcc2f427e997d1535a503613a83f088;p=freeside.git diff --git a/rt/lib/RT/Test/GnuPG.pm b/rt/lib/RT/Test/GnuPG.pm index e5a08b75a..fc162aa84 100644 --- a/rt/lib/RT/Test/GnuPG.pm +++ b/rt/lib/RT/Test/GnuPG.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -64,9 +64,9 @@ sub import { my %args = @_; my $t = $class->builder; - $t->plan( skip_all => 'GnuPG required.' ) + RT::Test::plan( skip_all => 'GnuPG required.' ) unless GnuPG::Interface->require; - $t->plan( skip_all => 'gpg executable is required.' ) + RT::Test::plan( skip_all => 'gpg executable is required.' ) unless RT::Test->find_executable('gpg'); $class->SUPER::import(%args); @@ -204,13 +204,17 @@ sub check_text_emails { my $content = $type eq 'email' ? "Some content" - : "Attachment content"; + : $args{Attachment}; if ( $args{'Encrypt'} ) { - unlike $mail, qr/$content/, "outgoing $type was encrypted"; + unlike $mail, qr/$content/, "outgoing $type is not in plaintext"; + my $entity = RT::Test::parse_mail($mail); + my @res = RT::Crypt->VerifyDecrypt(Entity => $entity); + like $res[0]{'status'}, qr/DECRYPTION_OKAY/, "Decrypts OK"; + like $entity->as_string, qr/$content/, "outgoing decrypts to contain $type content"; } else { like $mail, qr/$content/, "outgoing $type was not encrypted"; - } + } next unless $type eq 'email';