unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 66b85d5bf617e84b55c32f2083635cfb4ad4b2d3 3222 bytes (raw)
name: test/T359-inline-pgp-decryption.sh 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
 
#!/usr/bin/env bash

test_description='Decryption of inline PGP messages'
. $(dirname "$0")/test-lib.sh || exit 1

##################################################

add_gnupg_home

test_begin_subtest "Adding inline PGP encrypted message"
mkdir -p "$MAIL_DIR/cur"
cat <<EOF > "$MAIL_DIR/cur/inline-pgp-encrypted.eml"
Message-Id: inline-pgp-encrypted@testsuite.notmuchmail.org
Content-Type: text/plain
Subject: inline PGP encrypted message
Date: Sat, 01 Jan 2000 12:00:00 +0000
From: test_suite@notmuchmail.org
To: test_suite@notmuchmail.org

$(echo "this is the sekrit message" | gpg --no-tty --batch --quiet --trust-model=always --encrypt --armor --recipient test_suite@notmuchmail.org)
EOF
test_expect_success 'notmuch new'

test_begin_subtest "inline PGP decryption, --format=json"
test_subtest_broken_gmime_2
output=$(notmuch show --format=json --decrypt=true id:inline-pgp-encrypted@testsuite.notmuchmail.org \
    | notmuch_json_show_sanitize)
expected='
 [[[{"body": [{
 "content": "this is the sekrit message\n",
 "content-type": "text/plain",
 "encstatus": [{"status": "good" }],
 "id": 1
 }],
 "date_relative": "2000-01-01",
 "excluded": false,
 "filename": ["YYYYY"],
 "headers": {
   "Date": "Sat, 01 Jan 2000 12:00:00 +0000",
   "From": "test_suite@notmuchmail.org",
   "Subject": "inline PGP encrypted message",
   "To": "test_suite@notmuchmail.org"
  },
 "id": "XXXXX",
 "match": true,
 "tags": ["encrypted", "inbox", "unread"],
 "timestamp": 946728000
 },
 []]]]'

test_expect_equal_json \
    "$output" \
    "$expected"

test_begin_subtest "inline PGP decryption for reply"
test_subtest_broken_gmime_2
output=$(notmuch reply --format=json --decrypt=true id:inline-pgp-encrypted@testsuite.notmuchmail.org \
    | notmuch_json_show_sanitize)
expected='
 {"original": {"body": [{
 "content": "this is the sekrit message\n",
 "content-type": "text/plain",
 "encstatus": [{"status": "good" }],
 "id": 1
 }],
 "date_relative": "2000-01-01",
 "excluded": false,
 "filename": ["YYYYY"],
 "headers": {
   "Date": "Sat, 01 Jan 2000 12:00:00 +0000",
   "From": "test_suite@notmuchmail.org",
   "Subject": "inline PGP encrypted message",
   "To": "test_suite@notmuchmail.org"
  },
 "id": "XXXXX",
 "match": false,
 "tags": ["encrypted", "inbox", "unread"],
 "timestamp": 946728000
 },
 "reply-headers": {
   "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
   "In-reply-to": "<inline-pgp-encrypted@testsuite.notmuchmail.org>",
   "References": "<inline-pgp-encrypted@testsuite.notmuchmail.org>",
   "Subject": "Re: inline PGP encrypted message"
 }
}'

test_expect_equal_json \
    "$output" \
    "$expected"

test_begin_subtest "searching for cleartext of inline PGP encrypted message should fail"
output=$(notmuch search 'sekrit')
expected=''
test_expect_equal "$output" "$expected"

test_begin_subtest "reindexing cleartext of inline PGP encrypted message should succeed"
test_subtest_broken_gmime_2
notmuch reindex --decrypt=true id:inline-pgp-encrypted@testsuite.notmuchmail.org
output=$(notmuch search 'sekrit')
expected='thread:0000000000000001   2000-01-01 [1/1] test_suite@notmuchmail.org; inline PGP encrypted message (encrypted inbox unread)'
test_expect_equal "$output" "$expected"

test_done

debug log:

solving 66b85d5b ...
found 66b85d5b in https://yhetil.org/notmuch/20171212071553.6440-6-dkg@fifthhorseman.net/
found 314ca786 in https://yhetil.org/notmuch/20171212071553.6440-4-dkg@fifthhorseman.net/
found c0db8eaf in https://yhetil.org/notmuch/20171212071553.6440-3-dkg@fifthhorseman.net/

applying [1/3] https://yhetil.org/notmuch/20171212071553.6440-3-dkg@fifthhorseman.net/
diff --git a/test/T359-inline-pgp-decryption.sh b/test/T359-inline-pgp-decryption.sh
new file mode 100755
index 00000000..c0db8eaf


applying [2/3] https://yhetil.org/notmuch/20171212071553.6440-4-dkg@fifthhorseman.net/
diff --git a/test/T359-inline-pgp-decryption.sh b/test/T359-inline-pgp-decryption.sh
index c0db8eaf..314ca786 100755


applying [3/3] https://yhetil.org/notmuch/20171212071553.6440-6-dkg@fifthhorseman.net/
diff --git a/test/T359-inline-pgp-decryption.sh b/test/T359-inline-pgp-decryption.sh
index 314ca786..66b85d5b 100755

Checking patch test/T359-inline-pgp-decryption.sh...
Applied patch test/T359-inline-pgp-decryption.sh cleanly.
Checking patch test/T359-inline-pgp-decryption.sh...
Applied patch test/T359-inline-pgp-decryption.sh cleanly.
Checking patch test/T359-inline-pgp-decryption.sh...
Applied patch test/T359-inline-pgp-decryption.sh cleanly.

index at:
100755 66b85d5bf617e84b55c32f2083635cfb4ad4b2d3	test/T359-inline-pgp-decryption.sh

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).