diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh index 7dab39a2..1d408af7 100755 --- a/test/T350-crypto.sh +++ b/test/T350-crypto.sh @@ -394,7 +394,7 @@ test_expect_equal_json \ test_begin_subtest "reply to encrypted message" output=$(notmuch reply --decrypt subject:"test encrypted message 002" \ - | grep -v -e '^In-Reply-To:' -e '^References:') + | notmuch_drop_mail_headers In-Reply-To References) expected='From: Notmuch Test Suite Subject: Re: test encrypted message 002 diff --git a/test/test-lib.sh b/test/test-lib.sh index d2b2a47f..09ee815d 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -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/'