]> git.notmuchmail.org Git - notmuch/blob - test/T351-pgpmime-mangling.sh
tests/smime: consistently quote $GNUPGHOME
[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 output=$(notmuch show --format=json --decrypt=true id:mixed-up@mangling.notmuchmail.org)
13 test_json_nodes <<<"$output" \
14                 'body:[0][0][0]'"$bodytext"
15
16 test_begin_subtest "reply to 'Mixed-Up' mangled PGP/MIME message correctly"
17 output=$(notmuch reply --format=json --decrypt=true id:mixed-up@mangling.notmuchmail.org)
18 test_json_nodes <<<"$output" \
19                 'body:["original"]'"$bodytext"
20
21 test_begin_subtest "repaired 'Mixed-up' messages can be found with index.repaired=mixedup"
22 output=$(notmuch search --output=messages property:index.repaired=mixedup)
23 test_expect_equal "$output" id:mixed-up@mangling.notmuchmail.org
24
25 test_begin_subtest "index cleartext of 'Mixed-Up' mangled PGP/MIME message"
26 test_expect_success 'notmuch reindex --decrypt=true id:mixed-up@mangling.notmuchmail.org'
27
28 test_begin_subtest "search cleartext of 'Mixed-Up' mangled PGP/MIME message"
29 output=$(notmuch search --output=messages body:password)
30 test_expect_equal "$output" id:mixed-up@mangling.notmuchmail.org
31
32 test_done