[Patch v2 2/5] test: add python tests for query.count_{messages,threads}
authorDavid Bremner <david@tethera.net>
Tue, 30 Dec 2014 20:29:37 +0000 (21:29 +0100)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:47:07 +0000 (14:47 -0700)
aa/188266f2211a601166e190c2672233913ef480 [new file with mode: 0644]

diff --git a/aa/188266f2211a601166e190c2672233913ef480 b/aa/188266f2211a601166e190c2672233913ef480
new file mode 100644 (file)
index 0000000..9979d4b
--- /dev/null
@@ -0,0 +1,88 @@
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8B1E9431FD0\r
+       for <notmuch@notmuchmail.org>; Tue, 30 Dec 2014 12:30:30 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id nEErvidhVu60 for <notmuch@notmuchmail.org>;\r
+       Tue, 30 Dec 2014 12:30:28 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+       (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 2D8EA431FD5\r
+       for <notmuch@notmuchmail.org>; Tue, 30 Dec 2014 12:30:27 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+       (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+       id 1Y63Qw-0000zo-O5; Tue, 30 Dec 2014 16:30:26 -0400\r
+Received: (nullmailer pid 10593 invoked by uid 1000); Tue, 30 Dec 2014\r
+       20:29:44 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v2 2/5] test: add python tests for\r
+       query.count_{messages,threads}\r
+Date: Tue, 30 Dec 2014 21:29:37 +0100\r
+Message-Id: <1419971380-10307-3-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.3\r
+In-Reply-To: <1419971380-10307-1-git-send-email-david@tethera.net>\r
+References: <1419971380-10307-1-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 30 Dec 2014 20:30:31 -0000\r
+\r
+These are more or less cargo culted from the existing python tests. In\r
+particular they compare against the results of doing an analogous\r
+query using the CLI.\r
+---\r
+ test/T390-python.sh | 20 ++++++++++++++++++++\r
+ 1 file changed, 20 insertions(+)\r
+\r
+diff --git a/test/T390-python.sh b/test/T390-python.sh\r
+index 3f03a2e..ddbf164 100755\r
+--- a/test/T390-python.sh\r
++++ b/test/T390-python.sh\r
+@@ -36,4 +36,24 @@ print db.find_message_by_filename("i-dont-exist")\r
+ EOF\r
+ test_expect_equal "$(cat OUTPUT)" "None"\r
\r
++test_begin_subtest "count messages"\r
++test_python <<EOF\r
++import notmuch\r
++db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)\r
++q_new = notmuch.Query(db, 'tag:inbox')\r
++print q_new.count_messages()\r
++EOF\r
++notmuch count --output=messages tag:inbox > EXPECTED\r
++test_expect_equal_file OUTPUT EXPECTED\r
++\r
++test_begin_subtest "count threads"\r
++test_python <<EOF\r
++import notmuch\r
++db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)\r
++q_new = notmuch.Query(db, 'tag:inbox')\r
++print q_new.count_threads()\r
++EOF\r
++notmuch count --output=threads tag:inbox > EXPECTED\r
++test_expect_equal_file OUTPUT EXPECTED\r
++\r
+ test_done\r
+-- \r
+2.1.3\r
+\r