RT 4.2.11, ticket#13852
[freeside.git] / rt / t / crypt / no-signer-address.t
1 use strict;
2 use warnings;
3
4 use RT::Test::GnuPG
5   tests         => undef,
6   gnupg_options => {
7     passphrase    => 'rt-test',
8     'trust-model' => 'always',
9   }
10 ;
11
12 my $queue;
13 {
14     $queue = RT::Test->load_or_create_queue(
15         Name => 'Regression',
16         SignAuto => 1,
17     );
18     ok $queue && $queue->id, 'loaded or created queue';
19     ok !$queue->CorrespondAddress, 'address not set';
20 }
21
22 # We don't use Test::Warn here, because it apparently only captures up
23 # to the first newline -- and the meat of this message is on the fourth
24 # line.
25 my @warnings;
26 local $SIG{__WARN__} = sub {
27     push @warnings, "@_";
28 };
29
30 my $ticket = RT::Ticket->new( RT->SystemUser );
31 my ($status, undef, $msg) = $ticket->Create(
32     Queue => $queue->id,
33     Subject => 'test',
34     Requestor => 'root@localhost',
35 );
36 ok( $status, "created ticket" ) or diag "error: $msg";
37
38 is( scalar @warnings, 1, "Got a warning" );
39 like( $warnings[0], qr{signing failed: secret key not available},
40     "Found warning of no secret key");
41
42 done_testing;