summaryrefslogtreecommitdiff
path: root/tests/email-print-mime-structure.sh
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-12-04 07:38:11 -0700
committerSean Whitton <spwhitton@spwhitton.name>2019-12-04 07:38:11 -0700
commit7fc83b718cdf6e7abddb61810d2cc6bd3e584689 (patch)
tree6a0d4eb57b60de897a6f80a24f0782949a294daf /tests/email-print-mime-structure.sh
parent7a5bdac3d0dc9d02ca75276bbb8fc1142247aaf1 (diff)
parentf3e1e5a552db990b2213ef850e056ecb7995558d (diff)
downloadmailscripts-7fc83b718cdf6e7abddb61810d2cc6bd3e584689.tar.gz
Merge tag 'debian/0.16-1' into buster-bpo
mailscripts release 0.16-1 for unstable (sid) [dgit] [dgit distro=debian no-split --quilt=linear] # gpg: Signature made Thu 28 Nov 2019 11:30:44 AM MST # gpg: using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240 # gpg: Good signature from "Sean Whitton <spwhitton@spwhitton.name>" [ultimate] # Primary key fingerprint: 8DC2 487E 51AB DD90 B5C4 753F 0F56 D055 3B6D 411B # Subkey fingerprint: 9B91 7007 AE03 0E36 E4FC 248B 695B 7AE4 BF06 6240
Diffstat (limited to 'tests/email-print-mime-structure.sh')
-rwxr-xr-xtests/email-print-mime-structure.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/email-print-mime-structure.sh b/tests/email-print-mime-structure.sh
new file mode 100755
index 0000000..b45294e
--- /dev/null
+++ b/tests/email-print-mime-structure.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+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
+ base="${eml%%.eml}"
+ pgpkey="$base.pgpkey"
+ p12key="$base.p12"
+ if [ -e "$pgpkey" ]; then
+ printf "Testing %s (PGPy)\n" "${eml##*/}"
+ test_eml "$base" --pgpkey "$pgpkey"
+
+ testgpghome=$(mktemp -d)
+ printf "Testing %s (GnuPG PGP/MIME)\n" "${eml##*/}"
+ gpg --homedir="$testgpghome" --batch --quiet --import <"$pgpkey"
+ GNUPGHOME="$testgpghome" test_eml "$base" --use-gpg-agent
+ rm -rf "$testgpghome"
+ elif [ -e "$p12key" ]; then
+ printf "Testing %s (OpenSSL)\n" "${eml##*/}"
+ grep -v ^- < "$p12key" | base64 -d | \
+ openssl pkcs12 -nocerts -nodes -passin pass: -passout pass: -out "$base.pemkey"
+ test_eml "$base" --cmskey "$base.pemkey"
+ rm -f "$base.pemkey"
+
+ testgpghome=$(mktemp -d)
+ printf "Testing %s (GnuPG S/MIME)\n" "${eml##*/}"
+ gpgsm --pinentry-mode=loopback --passphrase-fd 4 4<<<'' --homedir="$testgpghome" --batch --quiet --import <"$p12key"
+ GNUPGHOME="$testgpghome" test_eml "$base" --use-gpg-agent
+ rm -rf "$testgpghome"
+ else
+ printf "Testing %s\n" "${eml##*/}"
+ test_eml "$base"
+ fi
+done