]> git.notmuchmail.org Git - notmuch/blobdiff - test/test-lib.sh
test/crypto: remove headers more robustly
[notmuch] / test / test-lib.sh
index d2b2a47f495d6025e77dd2a5ad5ed56ccf9474f4..09ee815d80605c31de722976a3236835638553ef 100644 (file)
@@ -507,6 +507,16 @@ NOTMUCH_DUMP_TAGS ()
     notmuch dump --include=tags "${@}" | sed '/^#/d' | sort
 }
 
+notmuch_drop_mail_headers ()
+{
+    $NOTMUCH_PYTHON -c "
+import email,sys
+msg=email.message_from_file(sys.stdin)
+for hdr in sys.argv[1:]: del msg[hdr]
+print(msg.as_string(False))
+" $*
+}
+
 notmuch_search_sanitize ()
 {
     perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/'