aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÖrjan Ekeberg <ekeberg@kth.se>2019-04-12 14:01:13 +0200
committerDavid Bremner <david@tethera.net>2019-04-14 08:01:30 -0300
commitbfe0f8dcc4cf25779e48a1ea7513ce6a5c64ba4c (patch)
treef5821c4d23899cc73c04f4ea1ebc35b9522a8f2b
parent606f2a66157cf5d58a6d187e0163249a4e61ecc8 (diff)
test: add test for checking forwarded messages
Add test of forwarding messages from within emacs. The first test checks that a references header is properly added to the new message. The second test checks that the send-hook of the forwarding message adds a forwarded-tag to the original message.
-rwxr-xr-xtest/T730-emacs-forwarding.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/T730-emacs-forwarding.sh b/test/T730-emacs-forwarding.sh
new file mode 100755
index 00000000..45e61568
--- /dev/null
+++ b/test/T730-emacs-forwarding.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+test_description="emacs forwarding"
+. $(dirname "$0")/test-lib.sh || exit 1
+
+test_begin_subtest "Forward setting the correct references header"
+# Check that, when forwarding a message, the new message has
+# a References-header pointing to the original (forwarded) message.
+
+message_id='OriginalMessage@notmuchmail.org'
+add_message \
+ [id]="$message_id" \
+ '[from]="user@example.com"' \
+ '[subject]="This is the original message"' \
+ '[body]="Dummy text."'
+
+test_emacs_expect_t "
+ (let ((message-send-mail-function (lambda () t)))
+ (notmuch-show \"id:$message_id\")
+ (notmuch-show-forward-message)
+ (save-restriction
+ (message-narrow-to-headers)
+ (message-remove-header \"Fcc\")
+ (message-remove-header \"To\")
+ (message-add-header \"To: nobody@example.com\"))
+
+ (notmuch-mua-send)
+ (notmuch-test-expect-equal
+ (message-field-value \"References\") \"<$message_id>\"))
+"
+
+test_begin_subtest "Forwarding adding the forwarded tag"
+# Check that sending the forwarding message in the previous
+# subtest did add the forwarded-tag to the message that was forwarded.
+
+test_expect_equal "$(notmuch search --output=tags id:$message_id | sort)" \
+"forwarded
+inbox
+unread"
+
+test_done