summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDirk Hohndel <hohndel@infradead.org>2010-04-21 14:55:57 -0700
committerCarl Worth <cworth@cworth.org>2010-04-23 17:01:19 -0700
commit037cfc5f5a79e541ecd3789e0ec815c9d88c0223 (patch)
treee76d6f43bb82bac187d2dd49861dc2330cc3089c /test
parentb57d9635f50d5e9b53092218e81f6d2c391c363e (diff)
add From guessing tests to test suite
right now these are not trying to be overly fancy simply one test per strategy that we apply to figure out the best from address - including the fallback if there's nothing to go on Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
Diffstat (limited to 'test')
-rwxr-xr-xtest/notmuch-test103
1 files changed, 102 insertions, 1 deletions
diff --git a/test/notmuch-test b/test/notmuch-test
index 04c6470..7276372 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -62,6 +62,7 @@ increment_mtime ()
# '[cc]="Some User <user@example.com>"'
# [reply-to]=some-address
# [in-reply-to]=<message-id>
+# '[header]=full header line, including keyword'
#
# Additional values for email headers. If these are not provided
# then the relevant headers will simply not appear in the
@@ -116,6 +117,11 @@ generate_message ()
fi
additional_headers=""
+ if [ ! -z "${template[header]}" ]; then
+ additional_headers="${template[header]}
+${additional_headers}"
+ fi
+
if [ ! -z "${template[reply-to]}" ]; then
additional_headers="Reply-To: ${template[reply-to]}
${additional_headers}"
@@ -131,6 +137,7 @@ ${additional_headers}"
${additional_headers}"
fi
+
cat <<EOF >$gen_msg_filename
From: ${template[from]}
To: ${template[to]}
@@ -212,7 +219,7 @@ path=${MAIL_DIR}
[user]
name=Notmuch Test Suite
primary_email=test_suite@notmuchmail.org
-other_email=test_suite_other@notmuchmail.org
+other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
EOF
printf "Testing \"notmuch new\" in several variations:\n"
@@ -860,6 +867,100 @@ printf " Searching returns all three messages in one thread..."
output=$($NOTMUCH search foo | notmuch_search_sanitize)
pass_if_equal "$output" "thread:XXX 2000-01-01 [3/3] Notmuch Test Suite; brokenthreadtest (inbox unread)"
+printf " Magic from guessing (nothing to go on)...\t"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
+ '[body]="from guessing test"'
+
+output=$($NOTMUCH reply id:${gen_msg_id})
+pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, mailinglist@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> from guessing test"
+
+printf " Magic from guessing (Envelope-to:)...\t\t"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[header]="Envelope-To: test_suite_other@notmuchmail.org"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
+ '[body]="from guessing test"'
+
+output=$($NOTMUCH reply id:${gen_msg_id})
+pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, mailinglist@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> from guessing test"
+
+printf " Magic from guessing (X-Original-To:)...\t"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[header]="X-Original-To: test_suite_other@notmuchmail.org"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
+ '[body]="from guessing test"'
+
+output=$($NOTMUCH reply id:${gen_msg_id})
+pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, mailinglist@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> from guessing test"
+
+printf " Magic from guessing (Received: .. for ..)...\t"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[header]="Received: from mail.example.com (mail.example.com [1.1.1.1])\
+ by mail.notmuchmail.org (some MTA) with ESMTP id 12345678\
+ for <test_suite_other@notmuchmail.org>; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
+ '[body]="from guessing test"'
+
+output=$($NOTMUCH reply id:${gen_msg_id})
+pass_if_equal "$output" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, mailinglist@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> from guessing test"
+
+printf " Magic from guessing (Received: domain)...\t"
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=mailinglist@notmuchmail.org \
+ [subject]=notmuch-reply-test \
+ '[header]="Received: from mail.example.com (mail.example.com [1.1.1.1])\
+ by mail.otherdomain.org (some MTA) with ESMTP id 12345678\
+ Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
+ '[body]="from guessing test"'
+
+output=$($NOTMUCH reply id:${gen_msg_id})
+pass_if_equal "$output" "From: Notmuch Test Suite <test_suite@otherdomain.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>, mailinglist@notmuchmail.org
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
+> from guessing test"
+
+
echo ""
echo "Notmuch test suite complete."