aboutsummaryrefslogtreecommitdiff
path: root/t/require-key-data.t
blob: 03be10016790721257c59769a572487a2042c68d (plain) (blame)
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
#!perl -T

use strict;
use warnings;
use utf8;

use English '-no_match_vars';
use Test::More tests => 4;

use Mail::Run::Crypt;

our $VERSION = '0.08';

{
    my $mrc;
    my $error;
    my %opts = (
        mailto     => 'nobody@example.com',
        sign       => 1,
        passphrase => 'faster than the fastest horse alive',
    );
    eval { $mrc = Mail::Run::Crypt->new(%opts) } or $error = $EVAL_ERROR;
    ok( defined $error,                                'no_keyid_failed' );
    ok( $error =~ m/^\Qkeyid required for signing/msx, 'no_keyid_errorstr' );
}

{
    my $mrc;
    my $error;
    my %opts = (
        mailto => 'nobody@example.com',
        sign   => 1,
        keyid  => '0x12345678DEADBEEF',
    );
    eval { $mrc = Mail::Run::Crypt->new(%opts) } or $error = $EVAL_ERROR;
    ok( defined $error, 'no_passphrase_failed' );
    ok( $error =~ m/^\Qpassphrase required for signing/msx,
        'no_passphrase_errorstr' );
}