X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FTest%2FGnuPG.pm;fp=rt%2Flib%2FRT%2FTest%2FGnuPG.pm;h=d803399e04c7dfbe37f91d476a6ce91933709277;hp=e5a08b75a1072fc4a5674508764eb5ee083c99e3;hb=de9d037528895f7151a9aead6724ce2df95f9586;hpb=b226bc6bd81f999176cdbfa53a799033ff0a0307 diff --git a/rt/lib/RT/Test/GnuPG.pm b/rt/lib/RT/Test/GnuPG.pm index e5a08b75a..d803399e0 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-2017 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';