Skip to content

Commit

Permalink
Migrate to RT::Test::Crypt for code that still uses deprecated RT::Te…
Browse files Browse the repository at this point in the history
…st::SMIME
  • Loading branch information
sunnavy committed Sep 13, 2021
1 parent 2611173 commit 60cf513
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions t/mail/smime/separate_certs.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use strict;
use warnings;

use RT::Test::SMIME tests => undef;
use RT::Test::Crypt SMIME => 1, tests => undef;

use IPC::Run3 'run3';
use Test::Warn;
Expand All @@ -25,7 +25,7 @@ my $key_ring = RT->Config->Get('SMIME')->{'Keyring'};
for my $key ( keys %signing ) {
diag "Testing signing with $key";

RT::Test::SMIME->import_key('[email protected]');
RT::Test::Crypt->smime_import_key('[email protected]');
if ( $key ne '[email protected]' ) {
rename File::Spec->catfile( $key_ring, '[email protected]' ), File::Spec->catfile( $key_ring, $key )
or die $!;
Expand All @@ -47,7 +47,7 @@ END
like( $mails[0], qr'Content-Type: application/x-pkcs7-signature', 'Sent message contains signature' );

my ( $buf, $err );
run3( [ qw(openssl smime -verify), '-CAfile', RT::Test::SMIME->key_path . "/demoCA/cacert.pem", ],
run3( [ qw(openssl smime -verify), '-CAfile', RT::Test::Crypt->smime_key_path . "/demoCA/cacert.pem", ],
\$mails[0], \$buf, \$err );

like( $err, qr'Verification successful', 'Verification output' );
Expand All @@ -73,12 +73,12 @@ my %encryption = (
my $root = RT::Test->load_or_create_user( Name => 'root' );
( $ret, $msg ) = $root->SetEmailAddress('[email protected]');
ok( $ret, 'set root email to [email protected]' );
RT::Test::SMIME->import_key( '[email protected]', $root );
RT::Test::Crypt->smime_import_key( '[email protected]', $root );

for my $key ( keys %encryption ) {
diag "Testing decryption with $key";

RT::Test::SMIME->import_key('[email protected]');
RT::Test::Crypt->smime_import_key('[email protected]');
if ( $key ne '[email protected]' ) {
rename File::Spec->catfile( $key_ring, '[email protected]' ), File::Spec->catfile( $key_ring, $key )
or die $!;
Expand All @@ -90,7 +90,7 @@ for my $key ( keys %encryption ) {
-from => '[email protected]',
-to => '[email protected]',
-subject => "Encrypted message for queue",
RT::Test::SMIME->key_path('[email protected]'),
RT::Test::Crypt->smime_key_path('[email protected]'),
],
\"\nthis is content",
\$buf,
Expand Down

0 comments on commit 60cf513

Please sign in to comment.