Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Sympa
Commits
f3dfbc69
Commit
f3dfbc69
authored
Feb 14, 2020
by
IKEDA Soji
Browse files
Adding tests for
96614ad6
parent
96614ad6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
f3dfbc69
...
...
@@ -30,6 +30,7 @@ check_SCRIPTS = \
t/02_Sympa_DatabaseManager.t
\
t/Language.t
\
t/LockedFile.t
\
t/Message_smime.t
\
t/Regexps.t
\
t/compile_modules.t
\
t/compile_executables.t
\
...
...
@@ -59,6 +60,8 @@ check_DATA = \
t/data/sympa.conf
\
t/data/sympa.sqlite
\
t/data/etc/auth.conf
\
t/samples/signed.eml
\
t/samples/unsigned.eml
\
xt/perlcriticrc
noinst_SCRIPTS
=
\
xt/critic.t
\
...
...
t/Message_smime.t
0 → 100644
View file @
f3dfbc69
# -*- indent-tabs-mode: nil; -*-
# vim:ft=perl:et:sw=4
# $Id$
use
strict
;
use
warnings
;
use
English
qw(-no_match_vars)
;
use
Test::
More
;
use
Sympa::
Log
;
use
Sympa::
Message
;
%
Conf::
Conf
=
(
sender_headers
=>
'
From
',
);
Sympa::
Log
->
instance
->
{
log_to_stderr
}
=
'
err
';
# ToDo: smime_encrypt()
# ToDo: smime_decrypt()
# ToDo: smime_sign()
# ToDo: check_smime_signature()
# is_signed()
is
test_is_signed
('
t/samples/unsigned.eml
'),
0
,
'
never signed
';
is
test_is_signed
('
t/samples/signed.eml
'),
1
,
'
multipart/signed S/MIME
';
#is test_is_signed('t/samples/signed-pkcs7.eml'), 1, 'PKCS#7 S/MIME';
#is test_is_signed('t/samples/signed-pgp.eml'), 0, 'multipart/signed PGP/MIME';
#is test_is_signed('t/samples/signed-pgp-inline.eml'), 0, 'PGP inline';
done_testing
();
sub
test_is_signed
{
my
$path
=
shift
;
open
my
$fh
,
'
<
',
$path
or
die
$ERRNO
;
my
$str
=
do
{
local
$RS
;
<
$fh
>
};
close
$fh
;
my
$message
=
Sympa::
Message
->
new
(
$str
,
context
=>
'
*
');
return
$message
->
is_signed
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment