File: gnupg-headers.t

package info (click to toggle)
request-tracker5 5.0.7%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 80,216 kB
  • sloc: javascript: 191,898; perl: 87,146; sh: 1,412; makefile: 487; python: 37; php: 15
file content (54 lines) | stat: -rw-r--r-- 1,675 bytes parent folder | download | duplicates (2)
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
43
44
45
46
47
48
49
50
51
52
53
54
use strict;
use warnings;

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

RT::Test->import_gnupg_key( 'recipient@example.com', 'public' );
RT::Test->import_gnupg_key( 'general@example.com',   'secret' );

ok( my $user = RT::User->new( RT->SystemUser ) );
ok( $user->Load('root'), "Loaded user 'root'" );
$user->SetEmailAddress('recipient@example.com');

my $queue = RT::Test->load_or_create_queue(
    Name              => 'General',
    CorrespondAddress => 'general@example.com',
);
ok $queue && $queue->id, 'loaded or created queue';
my $qid = $queue->id;

my ( $baseurl, $m ) = RT::Test->started_ok;
ok $m->login, 'logged in';

diag "test with Encrypt and Sign disabled";

$m->goto_create_ticket($queue);
$m->form_name('TicketCreate');
$m->field( 'Subject', 'Signing test' );
$m->field( 'Content', 'Some other content' );
$m->click('SubmitTicket');
$m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
$m->follow_link_ok( { url_regex => qr/Attachment\/WithHeaders\/\d+/ } );
$m->content_contains('X-RT-Encrypt: 0');
$m->content_contains('X-RT-Sign: 0');

diag "test with Encrypt and Sign enabled";

$m->goto_create_ticket($queue);
$m->form_name('TicketCreate');
$m->field( 'Subject', 'Signing test' );
$m->field( 'Content', 'Some other content' );
$m->tick( 'Encrypt', 1 );
$m->tick( 'Sign',    1 );
$m->click('SubmitTicket');
$m->content_like( qr/Ticket \d+ created/i, 'created the ticket' );
$m->follow_link_ok( { url_regex => qr/Attachment\/WithHeaders\/\d+/ } );
$m->content_contains('X-RT-Encrypt: 1');
$m->content_contains('X-RT-Sign: 1');