[Rt-commit] rt branch, 5.0/support-gpg2, updated. rt-5.0.0alpha1-22-gc0104ee00f

Aaron Trevena ast at bestpractical.com
Fri May 8 11:08:11 EDT 2020


The branch, 5.0/support-gpg2 has been updated
       via  c0104ee00f29d889b5ac57560de84057cc8a9484 (commit)
       via  8704c58776fc51f1b78324d0a1726c38ddb7eec6 (commit)
       via  41544e77275b12984ec902ba24103ea82e479408 (commit)
      from  5d2ec5691e42cb42a270d2a071af73ce827cf87f (commit)

Summary of changes:
 lib/RT/Test/Web.pm                  |  6 +++---
 t/99-policy.t                       |  2 +-
 t/mail/gnupg-incoming.t             | 41 ++++++++-----------------------------
 t/web/gnupg-select-keys-on-create.t |  2 --
 t/web/gnupg-select-keys-on-update.t |  3 +--
 5 files changed, 14 insertions(+), 40 deletions(-)

- Log -----------------------------------------------------------------
commit 41544e77275b12984ec902ba24103ea82e479408
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Fri May 8 15:34:29 2020 +0100

    fixed incoming mail test for gpg2 2.2

diff --git a/t/mail/gnupg-incoming.t b/t/mail/gnupg-incoming.t
index a132009022..86b296e5f9 100644
--- a/t/mail/gnupg-incoming.t
+++ b/t/mail/gnupg-incoming.t
@@ -8,12 +8,12 @@ use RT::Test::GnuPG
     passphrase => 'rt-test',
   };
 
+copy_test_keyring_to_homedir(use_legacy_keys => 1);
+
 use String::ShellQuote 'shell_quote';
 use IPC::Run3 'run3';
 use MIME::Base64;
 
-copy_test_keys_to_homedir(use_legacy_keys => 1);
-
 my ($baseurl, $m) = RT::Test->started_ok;
 
 # configure key for General queue
@@ -22,6 +22,7 @@ $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );
 $m->submit_form( form_number => 3,
                  fields      => { CorrespondAddress => 'general at example.com' } );
+
 $m->content_like(qr/general\@example.com.* - never/, 'has key info.');
 
 ok(my $user = RT::User->new(RT->SystemUser));
@@ -58,25 +59,6 @@ RT::Test->close_mailgate_ok($mail);
 }
 
 # test for signed mail
-my $buf = '';
-
-run3(
-    shell_quote(
-        qw(echo "recipient" | gpg --batch --yes --no-tty --armor --sign),
-        '--default-key' => 'recipient at example.com',
-        '--homedir'     => $homedir,
-        '--passphrase-fd'  => 0,
-        '--no-permission-warning',
-    ),
-    \"fnord\r\n",
-    \$buf,
-    \*STDOUT
-);
-
-warn "encrypted via cli : $buf";
-
-#####
-
 my $gnupg = get_test_gnupg_interface;
 # This time we'll catch the standard error for our perusing
 my ( $input, $output, $error ) = ( IO::Handle->new(),
@@ -106,7 +88,12 @@ print $input @original_plaintext;
 # indicating we are done
 close $input;
 
-my @ciphertext   = <$output>;  # reading the output
+my $buf;
+while (1) {
+    my $read_ok = $output->read($buf, 64, length($buf));
+    last if not $read_ok;
+}
+
 my @error_output = <$error>;   # reading the error
 
 close $output;
@@ -114,16 +101,6 @@ close $error;
 
 waitpid $pid, 0;  # clean up the finished GnuPG process
 
-use Data::Dumper;
-warn Dumper ({ciphertext => \@ciphertext,
-              error_output => \@error_output
-          });
-
-
-$buf = join('', at ciphertext);
-
-#####
-
 $mail = RT::Test->open_mailgate_ok($baseurl);
 print $mail <<"EOF";
 From: recipient\@example.com

commit 8704c58776fc51f1b78324d0a1726c38ddb7eec6
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Fri May 8 16:07:37 2020 +0100

    fixes and cleanup for web gnupg key selection tests

diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index 331e3cfa3a..3f83bdae95 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -42,8 +42,6 @@ diag "check that signing doesn't work if there is no key";
     RT::Test->trust_gnupg_key('rt-recipient at example.com');
     my %res = RT::Crypt->GetKeysInfo( Key => 'rt-recipient at example.com' );
     is $res{'info'}[0]{'TrustTerse'}, 'ultimate', 'ultimately trusted key';
-    # use Data::Dumper;
-    # warn Dumper ( { keys_info_after => $res{'info'} }) ;
 }
 
 diag "check that things don't work if there is no key";
diff --git a/t/web/gnupg-select-keys-on-update.t b/t/web/gnupg-select-keys-on-update.t
index 2f31a0f0d2..71a56c40f7 100644
--- a/t/web/gnupg-select-keys-on-update.t
+++ b/t/web/gnupg-select-keys-on-update.t
@@ -45,7 +45,7 @@ diag "check that signing doesn't work if there is no key";
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
 
-    $m->next_warning_like(qr/(secret key not available|No secret key)/);
+    $m->warnings_exist(qr/(secret key not available|No secret key)/);
     $m->no_leftover_warnings_ok;
 }
 
@@ -191,7 +191,6 @@ diag "check that things still doesn't work if two keys are not trusted";
     RT::Test->lsign_gnupg_key( $fpr1 );
     my %res = RT::Crypt->GetKeysInfo( Key => 'rt-test at example.com' );
     ok $res{'info'}[0]{'TrustLevel'} > 0, 'trusted key';
-    is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
 }
 
 diag "check that we see key selector even if only one key is trusted but there are more keys";

commit c0104ee00f29d889b5ac57560de84057cc8a9484
Author: Aaron Trevena <ast at bestpractical.com>
Date:   Fri May 8 16:07:58 2020 +0100

    policy test (partial) fixes

diff --git a/lib/RT/Test/Web.pm b/lib/RT/Test/Web.pm
index abd3f9b03a..c6239ad7a3 100644
--- a/lib/RT/Test/Web.pm
+++ b/lib/RT/Test/Web.pm
@@ -258,10 +258,10 @@ sub warnings_exist {
     }
     else {
         foreach my $warning (@warnings) {
-	   if ($warning =~ $re) {
+           if ($warning =~ $re) {
                return Test::More::pass($name);
-	   }
-	}
+           }
+        }
     }
     Test::More::fail("no warnings emitted matching $re");
     return 0;
diff --git a/t/99-policy.t b/t/99-policy.t
index 6bfff32a25..f737793109 100644
--- a/t/99-policy.t
+++ b/t/99-policy.t
@@ -132,7 +132,7 @@ check( $_, exec => -1 )
     for grep {m{^share/(po|fonts)/}} @files;
 
 check( $_, exec => -1 )
-    for grep {m{^t/data/}} @files;
+    for grep {m{^t/data/.*((?!/bin).)}} @files;
 
 check( $_, exec => -1, bps_tag => -1 )
     for grep {m{^etc/[^/]+$}} @files;

-----------------------------------------------------------------------


More information about the rt-commit mailing list