File: no-signer-address.t

package info (click to toggle)
request-tracker5 5.0.3%2Bdfsg-3~deb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 77,648 kB
  • sloc: javascript: 187,930; perl: 79,061; sh: 1,302; makefile: 471; python: 37; php: 15
file content (42 lines) | stat: -rw-r--r-- 1,055 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use strict;
use warnings;

use RT::Test::Crypt
  GnuPG         => 1,
  tests         => undef,
  gnupg_options => {
    passphrase    => 'rt-test',
    'trust-model' => 'always',
  }
;

my $queue;
{
    $queue = RT::Test->load_or_create_queue(
        Name => 'Regression',
        SignAuto => 1,
    );
    ok $queue && $queue->id, 'loaded or created queue';
    ok !$queue->CorrespondAddress, 'address not set';
}

# We don't use Test::Warn here, because it apparently only captures up
# to the first newline -- and the meat of this message is on the fourth
# line.
my @warnings;
local $SIG{__WARN__} = sub {
    push @warnings, "@_";
};

my $ticket = RT::Ticket->new( RT->SystemUser );
my ($status, undef, $msg) = $ticket->Create(
    Queue => $queue->id,
    Subject => 'test',
    Requestor => 'root@localhost',
);
ok( $status, "created ticket" ) or diag "error: $msg";

is( scalar @warnings, 1, "Got a warning" );
like( $warnings[0], qr{signing failed: (?:secret key not available|No secret key)}, "Found warning of no secret key" );

done_testing;