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 431B0429E26 for ; Thu, 12 Jan 2012 09:31:57 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 gidwN15mxerH for ; Thu, 12 Jan 2012 09:31:56 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 085E9431FB6 for ; Thu, 12 Jan 2012 09:31:55 -0800 (PST) Received: by werm12 with SMTP id m12so1813791wer.26 for ; Thu, 12 Jan 2012 09:31:54 -0800 (PST) Received: by 10.216.137.97 with SMTP id x75mr431119wei.57.1326389514805; Thu, 12 Jan 2012 09:31:54 -0800 (PST) Received: from localhost ([109.131.126.209]) by mx.google.com with ESMTPS id h13sm6506454wbn.17.2012.01.12.09.31.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Jan 2012 09:31:54 -0800 (PST) From: Pieter Praet To: David Bremner , Dmitry Kurochkin Subject: [PATCH] test: cli: getting/setting/removing config values Date: Thu, 12 Jan 2012 18:30:01 +0100 Message-Id: <1326389401-20468-1-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.8.1 In-Reply-To: <87y5tckf1y.fsf@praet.org> References: <87y5tckf1y.fsf@praet.org> Cc: Notmuch Mail 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: Thu, 12 Jan 2012 17:31:57 -0000 Should have come before commit 1df71b55 --- test/config | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/notmuch-test | 1 + 2 files changed, 89 insertions(+), 0 deletions(-) create mode 100755 test/config diff --git a/test/config b/test/config new file mode 100755 index 0000000..ee3126c --- /dev/null +++ b/test/config @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +test_description='notmuch config' +. ./test-lib.sh + + +config_options=( + "database.path" + "user.name" + "user.primary_email" + "user.other_email" + "new.tags" + "maildir.synchronize_flags" +) + + +test_begin_subtest 'getting config: "config get
."' +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT +cat >EXPECTED <. [values ...]"' +notmuch config set database.path /path/to/maildir +notmuch config set user.name "User Name" +notmuch config set user.primary_email primary_email@notmuchmail.org +notmuch config set user.other_email alt1@notmuchmail.org alt2@notmuchmail.org +notmuch config set new.tags tag1 tag2 tag3 +notmuch config set maildir.synchronize_flags false +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT +cat >EXPECTED <."' +notmuch config set database.path +notmuch config set user.name +notmuch config set user.primary_email +notmuch config set user.other_email +notmuch config set new.tags +notmuch config set maildir.synchronize_flags +echo -n "" > OUTPUT +for i in ${config_options[*]} ; do + notmuch config get "${i}" +done >> OUTPUT + +# FIXME: Not the most robust nor portable solution here... +# Especially `hostname --domain' may have unwanted effects on +# some platforms, e.g. setting your hostname to "--domain" ;) +fallback_name="$(grep $(id -un) /etc/passwd | cut -d ":" -f 5 | cut -d "," -f 1)" +fallback_email="$(id -un)@$(hostname).$(hostname --domain)" + +cat >EXPECTED <