test: make fallback to duplicate test more robust.

The original intent of this test was to verify that notmuch show was
not crashing when the first file (where headers are being read from)
was deleted. Run the output through some sanitization so that as we
add and delete copies we don't have to update this test.
This commit is contained in:
David Bremner 2017-08-27 20:58:19 -03:00
parent 1348212cb0
commit 44914f1c3b

View file

@ -39,23 +39,24 @@ test_expect_equal_file EXPECTED OUTPUT
rm ${MAIL_DIR}/copy1 rm ${MAIL_DIR}/copy1
test_begin_subtest 'Deleted first duplicate file does not stop notmuch show from working' test_begin_subtest 'Deleted first duplicate file does not stop notmuch show from working'
output=$(notmuch show --body=false --format=json id:duplicate) output=$(notmuch show --body=false --format=json id:duplicate |
notmuch_json_show_sanitize | sed 's/message [0-9]/A_SUBJECT/')
expected='[[[{ expected='[[[{
"id": "'duplicate'", "id": "XXXXX",
"match": true, "match": true,
"excluded": false, "excluded": false,
"filename": [ "filename": [
"'"${MAIL_DIR}"/copy1'", "'"${MAIL_DIR}"/copy1'",
"'"${MAIL_DIR}"/copy2'" "'"${MAIL_DIR}"/copy2'"
], ],
"timestamp": 978709435, "timestamp": 42,
"date_relative": "2001-01-05", "date_relative": "2001-01-05",
"tags": ["inbox","unread"], "tags": ["inbox","unread"],
"headers": { "headers": {
"Subject": "message 2", "Subject": "A_SUBJECT",
"From": "Notmuch Test Suite <test_suite@notmuchmail.org>", "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
"To": "Notmuch Test Suite <test_suite@notmuchmail.org>", "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
"Date": "Fri, 05 Jan 2001 15:43:55 +0000" "Date": "GENERATED_DATE"
} }
}, },
[]]]]' []]]]'