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