1#!/usr/bin/env bash 2 3test_description='PGP/MIME message mangling' 4. $(dirname "$0")/test-lib.sh || exit 1 5 6add_gnupg_home 7add_email_corpus mangling 8 9bodytext='["body"][0]["content"][1]["content"]="The password is \"abcd1234!\", please do not tell anyone.\n"' 10 11test_begin_subtest "show 'Mixed-Up' mangled PGP/MIME message correctly" 12output=$(notmuch show --format=json --decrypt=true id:mixed-up@mangling.notmuchmail.org) 13test_json_nodes <<<"$output" \ 14 'body:[0][0][0]'"$bodytext" 15 16test_begin_subtest "reply to 'Mixed-Up' mangled PGP/MIME message correctly" 17output=$(notmuch reply --format=json --decrypt=true id:mixed-up@mangling.notmuchmail.org) 18test_json_nodes <<<"$output" \ 19 'body:["original"]'"$bodytext" 20 21test_begin_subtest "repaired 'Mixed-up' messages can be found with index.repaired=mixedup" 22output=$(notmuch search --output=messages property:index.repaired=mixedup) 23test_expect_equal "$output" id:mixed-up@mangling.notmuchmail.org 24 25test_begin_subtest "index cleartext of 'Mixed-Up' mangled PGP/MIME message" 26test_expect_success 'notmuch reindex --decrypt=true id:mixed-up@mangling.notmuchmail.org' 27 28test_begin_subtest "search cleartext of 'Mixed-Up' mangled PGP/MIME message" 29output=$(notmuch search --output=messages body:password) 30test_expect_equal "$output" id:mixed-up@mangling.notmuchmail.org 31 32test_done 33