]>
iEval git - app-edwardng.git/blob - t/App-EdwardNG.t
5 use constant KEYID
=> '34B22806';
6 use constant EMAIL
=> 'EdwardNG (Key for testing EdwardNG) <edwardng@ieval.ro>';
8 use Test
::More tests
=> 20;
9 BEGIN { use_ok
('App::EdwardNG', qw
/import_pubkeys process_message/) };
10 $ENV{EDWARDNG_DEBUG
} = $ENV{TEST_VERBOSE
};
11 $ENV{EDWARDNG_KEYDIR
} = 't/keydir';
13 my $contains_pubkey = App
::EdwardNG
::mp
->parse_open('t/data/contains-pubkey');
14 my @keys = import_pubkeys
($contains_pubkey, App
::EdwardNG
::mg
);
15 is
$keys[0], 'DE12658069C2F09BF996CC855AAF79E969137654', 'import_pubkeys';
20 my ($name, $expected) = @_;
21 ($tmpl, %params) = process_message
("t/data/$name");
22 is
$tmpl, $expected, "Result for $name is $expected" or diag
"GnuPG said: $params{message}"
25 process
'mime-signed', 'sign';
26 is
$params{keyid
}, KEYID
, 'mime-signed keyid';
27 is
$params{email
}, EMAIL
, 'mime-signed email';
29 process
'mime-encrypted', 'encrypt';
30 like
$params{plaintext
}, qr/MIME encrypted/, 'mime-signed plaintext';
32 process
'mime-signed-encrypted', 'signencrypt';
33 is
$params{keyid
}, KEYID
, 'mime-signed-encrypted keyid';
34 is
$params{email
}, EMAIL
, 'mime-signed-encrypted email';
35 like
$params{plaintext
}, qr/MIME signed & encrypted/, 'mime-signed-encrypted plaintext';
37 process
'inline-signed', 'sign';
38 is
$params{keyid
}, KEYID
, 'inline-signed keyid';
39 is
$params{email
}, EMAIL
, 'inline-signed email';
41 process
'inline-encrypted', 'encrypt';
42 like
$params{plaintext
}, qr/Inline encrypted/, 'inline-signed plaintext';
44 process
'inline-signed-encrypted', 'signencrypt';
45 is
$params{keyid
}, KEYID
, 'inline-signed-encrypted keyid';
46 is
$params{email
}, EMAIL
, 'inline-signed-encrypted email';
47 like
$params{plaintext
}, qr/Inline signed & encrypted/, 'inline-signed-encrypted plaintext';
This page took 0.061509 seconds and 5 git commands to generate.