From eee332e1d21af4e67398c2e148146540dce14657 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 18 Oct 2014 09:22:35 +0200 Subject: [PATCH] [PATCH] test: add simple tests for post-insert hook --- 34/818c4a32005a686a60ec457c1b4e202941e595 | 101 ++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 34/818c4a32005a686a60ec457c1b4e202941e595 diff --git a/34/818c4a32005a686a60ec457c1b4e202941e595 b/34/818c4a32005a686a60ec457c1b4e202941e595 new file mode 100644 index 000000000..4f0b03327 --- /dev/null +++ b/34/818c4a32005a686a60ec457c1b4e202941e595 @@ -0,0 +1,101 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id A479B431FBC + for ; Sat, 18 Oct 2014 00:22:54 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id v-9I-8xYx1Is for ; + Sat, 18 Oct 2014 00:22:49 -0700 (PDT) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 27EAE431FB6 + for ; Sat, 18 Oct 2014 00:22:49 -0700 (PDT) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1XfOLg-0001X3-Om; Sat, 18 Oct 2014 04:22:48 -0300 +Received: (nullmailer pid 27657 invoked by uid 1000); Sat, 18 Oct 2014 + 07:22:43 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH] test: add simple tests for post-insert hook +Date: Sat, 18 Oct 2014 09:22:35 +0200 +Message-Id: <1413616955-27612-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.1 +In-Reply-To: + <27c7ada91f96deda6e51732e0397bffd2ef2ab42.1411914914.git.jani@nikula.org> +References: + <27c7ada91f96deda6e51732e0397bffd2ef2ab42.1411914914.git.jani@nikula.org> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 18 Oct 2014 07:22:54 -0000 + +Most of the existing tests for pre/post-new hook don't seem to apply. +--- + test/T400-hooks.sh | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/test/T400-hooks.sh b/test/T400-hooks.sh +index 77e8569..e741211 100755 +--- a/test/T400-hooks.sh ++++ b/test/T400-hooks.sh +@@ -30,6 +30,8 @@ rm_hooks () { + + # add a message to generate mail dir and database + add_message ++# create maildir structure for notmuch-insert ++mkdir -p "$MAIL_DIR"/{cur,new,tmp} + + test_begin_subtest "pre-new is run" + rm_hooks +@@ -45,6 +47,16 @@ create_echo_hook "post-new" expected output + notmuch new > /dev/null + test_expect_equal_file expected output + ++test_begin_subtest "post-insert hook is run" ++rm_hooks ++generate_message ++create_echo_hook "post-insert" expected output ++echo $gen_msg_filename ++cat output ++notmuch insert < "$gen_msg_filename" ++echo $? ++test_expect_equal_file expected output ++ + test_begin_subtest "pre-new is run before post-new" + rm_hooks + generate_message +@@ -82,6 +94,12 @@ test_expect_equal_file expected output + # depends on the previous subtest leaving broken hook behind + test_expect_code 1 "post-new non-zero exit status (notmuch status)" "notmuch new" + ++rm_hooks ++generate_message ++create_failing_hook "post-insert" ++test_expect_success "post-insert hook does not affect insert status" \ ++ "notmuch insert < \"$gen_msg_filename\" > /dev/null" ++ + # test_begin_subtest "hook without executable permissions" + rm_hooks + mkdir -p ${HOOK_DIR} +-- +2.1.1 + -- 2.26.2