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 60C6C431FBF for ; Sun, 5 Aug 2012 00:22:58 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, 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 WuDIodp+6Y9Z for ; Sun, 5 Aug 2012 00:22:56 -0700 (PDT) Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 13DE0431FB6 for ; Sun, 5 Aug 2012 00:22:47 -0700 (PDT) Received: by mail-pb0-f53.google.com with SMTP id ro8so3935886pbb.26 for ; Sun, 05 Aug 2012 00:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=uG4z+lTiI9253NJDkCc+U5QlIeLdCCa3yN6hNnzRJME=; b=QOc/Aj7W5qL41WLGtO+T/W9A28HapXTsafEF7VyiBSjNoW0tHU9YSP9GkH/Rs2hg8m PrK1fP2rOszbCM7VHRrQGaNRIEM0xjv7yr5Pj8oWZ/w8nY6fYWmIv6SbweTEu1uXFR4B Yo69GWLoLC7Ur4g/Jmq+Yf9dIuDfnjUl9KZH1TLOoMrDyArjlH+4mDkMt2GpfGePASjt CbupNXRk6DKXz/pz3qM9un4dr7zQZ1RxKDIGhAWl+zjWMjdmy3qh1U5e6IXAaAeiMt1z YNBXzPkfPXaltLYELcDJgQRFJBbRqH++ur1cIRF24ZkM0e4WwwUPHItzaKRud9OJ2YxQ dVPw== Received: by 10.68.239.164 with SMTP id vt4mr707205pbc.118.1344151366868; Sun, 05 Aug 2012 00:22:46 -0700 (PDT) Received: from localhost (215.42.233.220.static.exetel.com.au. [220.233.42.215]) by mx.google.com with ESMTPS id pi7sm6403699pbb.56.2012.08.05.00.22.43 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Aug 2012 00:22:46 -0700 (PDT) From: Peter Wang To: notmuch@notmuchmail.org Subject: [PATCH 2/4] test: conform to content-length fields (json) Date: Sun, 5 Aug 2012 17:22:23 +1000 Message-Id: <1344151345-25411-2-git-send-email-novalazy@gmail.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1344151345-25411-1-git-send-email-novalazy@gmail.com> References: <1344151345-25411-1-git-send-email-novalazy@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Sun, 05 Aug 2012 07:22:58 -0000 Update tests to expect content-length fields in show --format=json output, for leaf parts with omitted body content. --- test/crypto | 25 +++++++++++++++++-------- test/json | 2 +- test/multipart | 9 +++++---- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/test/crypto b/test/crypto index 5dd14c4..4a73dcc 100755 --- a/test/crypto +++ b/test/crypto @@ -61,7 +61,8 @@ expected='[[[{"id": "XXXXX", "content-type": "text/plain", "content": "This is a test signed message.\n"}, {"id": 3, - "content-type": "application/pgp-signature"}]}]}, + "content-type": "application/pgp-signature", + "content-length": 315}]}]}, []]]]' test_expect_equal_json \ "$output" \ @@ -95,7 +96,8 @@ expected='[[[{"id": "XXXXX", "content-type": "text/plain", "content": "This is a test signed message.\n"}, {"id": 3, - "content-type": "application/pgp-signature"}]}]}, + "content-type": "application/pgp-signature", + "content-length": 315}]}]}, []]]]' test_expect_equal_json \ "$output" \ @@ -127,7 +129,8 @@ expected='[[[{"id": "XXXXX", "content-type": "text/plain", "content": "This is a test signed message.\n"}, {"id": 3, - "content-type": "application/pgp-signature"}]}]}, + "content-type": "application/pgp-signature", + "content-length": 315}]}]}, []]]]' test_expect_equal_json \ "$output" \ @@ -196,7 +199,8 @@ expected='[[[{"id": "XXXXX", "sigstatus": [], "content-type": "multipart/encrypted", "content": [{"id": 2, - "content-type": "application/pgp-encrypted"}, + "content-type": "application/pgp-encrypted", + "content-length": 11}, {"id": 3, "content-type": "multipart/mixed", "content": [{"id": 4, @@ -204,6 +208,7 @@ expected='[[[{"id": "XXXXX", "content": "This is a test encrypted message.\n"}, {"id": 5, "content-type": "application/octet-stream", + "content-length": 28, "filename": "TESTATTACHMENT"}]}]}]}, []]]]' test_expect_equal_json \ @@ -249,9 +254,11 @@ expected='[[[{"id": "XXXXX", "encstatus": [{"status": "bad"}], "content-type": "multipart/encrypted", "content": [{"id": 2, - "content-type": "application/pgp-encrypted"}, + "content-type": "application/pgp-encrypted", + "content-length": 11}, {"id": 3, - "content-type": "application/octet-stream"}]}]}, + "content-type": "application/octet-stream", + "content-length": 652}]}]}, []]]]' test_expect_equal_json \ "$output" \ @@ -287,7 +294,8 @@ expected='[[[{"id": "XXXXX", "userid": " Notmuch Test Suite (INSECURE!)"}], "content-type": "multipart/encrypted", "content": [{"id": 2, - "content-type": "application/pgp-encrypted"}, + "content-type": "application/pgp-encrypted", + "content-length": 11}, {"id": 3, "content-type": "text/plain", "content": "This is another test encrypted message.\n"}]}]}, @@ -342,7 +350,8 @@ expected='[[[{"id": "XXXXX", "content-type": "text/plain", "content": "This is a test signed message.\n"}, {"id": 3, - "content-type": "application/pgp-signature"}]}]}, + "content-type": "application/pgp-signature", + "content-length": 315}]}]}, []]]]' test_expect_equal_json \ "$output" \ diff --git a/test/json b/test/json index ac8fa8e..ff2287e 100755 --- a/test/json +++ b/test/json @@ -45,7 +45,7 @@ emacs_deliver_message \ (insert \"Message-ID: <$id>\n\")" output=$(notmuch show --format=json "id:$id") filename=$(notmuch search --output=files "id:$id") -test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite \", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"filename\": \"README\"}]}]}, []]]]" +test_expect_equal_json "$output" "[[[{\"id\": \"$id\", \"match\": true, \"excluded\": false, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite \", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"content-length\": 12392, \"filename\": \"README\"}]}]}, []]]]" test_begin_subtest "Search message: json, utf-8" add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\"" diff --git a/test/multipart b/test/multipart index 0527f84..0f9e113 100755 --- a/test/multipart +++ b/test/multipart @@ -330,7 +330,7 @@ cat <EXPECTED {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, -{"id": 9, "content-type": "application/pgp-signature"}]}]} +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]}]} EOF test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" @@ -345,7 +345,7 @@ cat <EXPECTED {"id": 6, "content-type": "text/plain", "content": "This is an embedded message, with a multipart/alternative part.\n"}]}]}]}, {"id": 7, "content-type": "text/plain", "filename": "attachment", "content": "This is a text attachment.\n"}, {"id": 8, "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, -{"id": 9, "content-type": "application/pgp-signature"}]} +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197}]} EOF test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" @@ -412,7 +412,7 @@ test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" test_begin_subtest "--format=json --part=9, pgp signature (unverified)" notmuch show --format=json --part=9 'id:87liy5ap00.fsf@yoom.home.cworth.org' >OUTPUT cat <EXPECTED -{"id": 9, "content-type": "application/pgp-signature"} +{"id": 9, "content-type": "application/pgp-signature", "content-length": 197} EOF test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" @@ -636,7 +636,8 @@ cat <EXPECTED "content-type": "text/plain", "content": "And this message is signed.\n\n-Carl\n"}]}, {"id": 9, - "content-type": "application/pgp-signature"}]}]}} + "content-type": "application/pgp-signature", + "content-length": 197}]}]}} EOF test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED)" -- 1.7.4.4