]> iEval git - app-edwardng.git/blob - t/App-EdwardNG.t
Remove some useless debug information
[app-edwardng.git] / t / App-EdwardNG.t
1 #!/usr/bin/perl -w
2 use strict;
3 use warnings;
4
5 use constant KEYID => '34B22806';
6 use constant EMAIL => 'EdwardNG (Key for testing EdwardNG) <edwardng@ieval.ro>';
7
8 use Test::More tests => 19;
9 BEGIN { use_ok('App::EdwardNG') };
10 $ENV{EDWARDNG_DEBUG} = $ENV{TEST_VERBOSE};
11 $ENV{EDWARDNG_KEYDIR} = 't/keydir';
12
13 my ($tmpl, %params);
14
15 sub process {
16 my ($name, $expected) = @_;
17 ($tmpl, %params) = App::EdwardNG::process_message("t/data/$name");
18 is $tmpl, $expected, "Result for $name is $expected" or diag "GnuPG said: $params{message}"
19 }
20
21 process 'mime-signed', 'sign';
22 is $params{keyid}, KEYID, 'mime-signed keyid';
23 is $params{email}, EMAIL, 'mime-signed email';
24
25 process 'mime-encrypted', 'encrypt';
26 like $params{plaintext}, qr/MIME encrypted/, 'mime-signed plaintext';
27
28 process 'mime-signed-encrypted', 'signencrypt';
29 is $params{keyid}, KEYID, 'mime-signed-encrypted keyid';
30 is $params{email}, EMAIL, 'mime-signed-encrypted email';
31 like $params{plaintext}, qr/MIME signed & encrypted/, 'mime-signed-encrypted plaintext';
32
33 process 'inline-signed', 'sign';
34 is $params{keyid}, KEYID, 'inline-signed keyid';
35 is $params{email}, EMAIL, 'inline-signed email';
36
37 process 'inline-encrypted', 'encrypt';
38 like $params{plaintext}, qr/Inline encrypted/, 'inline-signed plaintext';
39
40 process 'inline-signed-encrypted', 'signencrypt';
41 is $params{keyid}, KEYID, 'inline-signed-encrypted keyid';
42 is $params{email}, EMAIL, 'inline-signed-encrypted email';
43 like $params{plaintext}, qr/Inline signed & encrypted/, 'inline-signed-encrypted plaintext';
This page took 0.0528 seconds and 4 git commands to generate.