summaryrefslogtreecommitdiff
path: root/tests/email-print-mime-structure.sh
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2019-11-25 01:53:55 -0500
committerSean Whitton <spwhitton@spwhitton.name>2019-11-25 07:46:31 -0700
commit93d309e682c0910556d79aa75c8871cb3f6860ae (patch)
tree5cfa34def592600524cc28ee9dcd7eae54f8988c /tests/email-print-mime-structure.sh
parente9e26fa3d84b9d38c4a33fb33f890b21b482ef13 (diff)
downloadmailscripts-93d309e682c0910556d79aa75c8871cb3f6860ae.tar.gz
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 <dkg@fifthhorseman.net>
Diffstat (limited to 'tests/email-print-mime-structure.sh')
-rwxr-xr-xtests/email-print-mime-structure.sh17
1 files changed, 15 insertions, 2 deletions
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