mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
test/crypto: remove headers more robustly
In [1], Vladimir Panteleev observed that the In-Reply-To and References headers could be wrapped in the 'default' output format of notmuch-reply, depending on the version of Emacs creating the message. In my own experiments notmuch-reply sometimes wraps headers with only one message-id if that message-id is long enough. However it happens, this causes the previous approach using grep to fail. Since I found the proposed unwrapping shell fragment in [1] a bit hard to follow, I decided to write a little python script instead. Then Tomi suggested a slight generalization of my script, and here we are. [1] id:20170817175145.3204-7-notmuch@thecybershadow.net
This commit is contained in:
parent
46bda291ba
commit
ec37900c5f
2 changed files with 11 additions and 1 deletions
|
@ -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 <test_suite@notmuchmail.org>
|
||||
Subject: Re: test encrypted message 002
|
||||
|
||||
|
|
|
@ -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/'
|
||||
|
|
Loading…
Reference in a new issue