From 93d309e682c0910556d79aa75c8871cb3f6860ae Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor Date: Mon, 25 Nov 2019 01:53:55 -0500 Subject: email-print-mime-structure: added test for PGP/MIME decryption The secret key material in this test comes from https://datatracker.ietf.org/doc/draft-bre-openpgp-samples/ Signed-off-by: Daniel Kahn Gillmor --- tests/email-print-mime-structure.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tests/email-print-mime-structure.sh') diff --git a/tests/email-print-mime-structure.sh b/tests/email-print-mime-structure.sh index 5efa2ca..0c0bb50 100755 --- a/tests/email-print-mime-structure.sh +++ b/tests/email-print-mime-structure.sh @@ -2,7 +2,20 @@ set -e +test_eml() { + message="$1" + shift + diff -u "$message.out" <(./email-print-mime-structure "$@" < "$message.eml") +} + for eml in tests/email-print-mime-structure/*.eml; do - printf "Testing %s\n" "${eml##*/}" - diff -u "${eml%%.eml}.out" <(./email-print-mime-structure < "$eml") + base="${eml%%.eml}" + pgpkey="$base.pgpkey" + if [ -e "$pgpkey" ]; then + printf "Testing %s (PGPy)\n" "${eml##*/}" + test_eml "$base" --pgpkey "$pgpkey" + else + printf "Testing %s\n" "${eml##*/}" + test_eml "$base" + fi done -- cgit v1.2.3