unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* test suite for fancy From guessing
@ 2010-04-21 21:55 Dirk Hohndel
  2010-04-21 21:55 ` [PATCH 1/2] add From guessing tests to test suite Dirk Hohndel
  2010-04-24  0:06 ` test suite for fancy From guessing Carl Worth
  0 siblings, 2 replies; 4+ messages in thread
From: Dirk Hohndel @ 2010-04-21 21:55 UTC (permalink / raw)
  To: notmuch


This adds five tests for the five main cases in the fancy from guessing.
It assumes that you have applied
id:1271451102-11336-1-git-send-email-hohndel@infradead.org which will get you
the latest fancy From guessing.

We have one test case each for
- nothing to go on
- Envelope-To:
- X-Original-To:
- Received: ... for ...
- Received: domain guessing

The second patch adds the Bcc headers that you will get as part of the 
results with an unpatched notmuch. I consider these Bcc headers broken
as they are a potential information leak; the Bcc always goes to the
primary email address, so information that isn't related to that account
is still routed back to it. Bcc logic should be fixed to copy the address
that is used as From: address

But since I don't use Bcc at all I didn't attempt to fix that part.

/D

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] add From guessing tests to test suite
  2010-04-21 21:55 test suite for fancy From guessing Dirk Hohndel
@ 2010-04-21 21:55 ` Dirk Hohndel
  2010-04-21 21:55   ` [PATCH 2/2] fix expected test result to include Bcc lines Dirk Hohndel
  2010-04-24  0:06 ` test suite for fancy From guessing Carl Worth
  1 sibling, 1 reply; 4+ messages in thread
From: Dirk Hohndel @ 2010-04-21 21:55 UTC (permalink / raw)
  To: notmuch

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>
---
 test/notmuch-test |  103 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 102 insertions(+), 1 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index 53ee189..855850c 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -60,6 +60,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
@@ -114,6 +115,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}"
@@ -129,6 +135,7 @@ ${additional_headers}"
 ${additional_headers}"
     fi
 
+
 cat <<EOF >$gen_msg_filename
 From: ${template[from]}
 To: ${template[to]}
@@ -203,7 +210,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"
@@ -629,6 +636,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."
 
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] fix expected test result to include Bcc lines
  2010-04-21 21:55 ` [PATCH 1/2] add From guessing tests to test suite Dirk Hohndel
@ 2010-04-21 21:55   ` Dirk Hohndel
  0 siblings, 0 replies; 4+ messages in thread
From: Dirk Hohndel @ 2010-04-21 21:55 UTC (permalink / raw)
  To: notmuch

this test actually tests behavior that I consider as broken.
The Bcc should be to the same address as used in the From line,
otherwise we are creating a potential information leak as email
that is related to one email account (say, work) is copied to
a different account

Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
---
 test/notmuch-test |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index 855850c..d939c03 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -647,6 +647,7 @@ 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
+Bcc: test_suite@notmuchmail.org
 In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
@@ -665,6 +666,7 @@ 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
+Bcc: test_suite@notmuchmail.org
 In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
@@ -683,6 +685,7 @@ 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
+Bcc: test_suite@notmuchmail.org
 In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
@@ -703,6 +706,7 @@ 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
+Bcc: test_suite@notmuchmail.org
 In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
@@ -723,6 +727,7 @@ 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
+Bcc: test_suite@notmuchmail.org
 In-Reply-To: <${gen_msg_id}>
 References: <${gen_msg_id}>
 
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: test suite for fancy From guessing
  2010-04-21 21:55 test suite for fancy From guessing Dirk Hohndel
  2010-04-21 21:55 ` [PATCH 1/2] add From guessing tests to test suite Dirk Hohndel
@ 2010-04-24  0:06 ` Carl Worth
  1 sibling, 0 replies; 4+ messages in thread
From: Carl Worth @ 2010-04-24  0:06 UTC (permalink / raw)
  To: Dirk Hohndel, notmuch

[-- Attachment #1: Type: text/plain, Size: 759 bytes --]

On Wed, 21 Apr 2010 14:55:56 -0700, Dirk Hohndel <hohndel@infradead.org> wrote:
> This adds five tests for the five main cases in the fancy from guessing.
> It assumes that you have applied
> id:1271451102-11336-1-git-send-email-hohndel@infradead.org which will get you
> the latest fancy From guessing.

Thanks very much for these tests! (I somehow had missed them when I
first collected my 0.3 merge-window commits.)

I've pushed these out now. And that's even before the feature of
interest, (because with the latest patches, these tests cause "notmuch
reply" to segfault). I'm not getting a segfault with the test suite
based on the code in master now, (just failures as expected since the
feature isn't implemented yet).

Looking forward to more.

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-24  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21 21:55 test suite for fancy From guessing Dirk Hohndel
2010-04-21 21:55 ` [PATCH 1/2] add From guessing tests to test suite Dirk Hohndel
2010-04-21 21:55   ` [PATCH 2/2] fix expected test result to include Bcc lines Dirk Hohndel
2010-04-24  0:06 ` test suite for fancy From guessing Carl Worth

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).