unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Florian Klink <flokli@flokli.de>
To: notmuch@notmuchmail.org
Cc: David Bremner <david@tethera.net>,
	Andreas Rammhold <andreas@rammhold.de>,
	Florian Klink <flokli@flokli.de>
Subject: [PATCH v2 2/2] T390-python: add test for get_message_parts and special characters
Date: Sun, 24 Sep 2017 14:36:12 +0200	[thread overview]
Message-ID: <20170924123612.26679-2-flokli@flokli.de> (raw)
In-Reply-To: <20170924123612.26679-1-flokli@flokli.de>

This imports a message with ISO-8859-2 encoded characters, then opens
the database using the python bindings. We peek through all mesage
parts, afterwards print the message id.

Signed-off-by: Florian Klink <flokli@flokli.de>
Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
---
 test/T390-python.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/test/T390-python.sh b/test/T390-python.sh
index a9a61145..5921cac9 100755
--- a/test/T390-python.sh
+++ b/test/T390-python.sh
@@ -56,5 +56,22 @@ grep '^[0-9a-f]' OUTPUT > INITIAL_OUTPUT
 test_begin_subtest "output of count matches test code"
 notmuch count --lastmod '*' | cut -f2-3 > OUTPUT
 test_expect_equal_file INITIAL_OUTPUT OUTPUT
+add_message '[content-type]="text/plain; charset=iso-8859-2"' \
+            '[content-transfer-encoding]=8bit' \
+            '[subject]="ISO-8859-2 encoded message"' \
+            "[body]=$'Czech word tu\350\362\341\350\350\355 means pinguin\'s.'" # ISO-8859-2 characters are generated by shell's escape sequences
+test_begin_subtest "Add ISO-8859-2 encoded message, call get_message_parts"
+test_python <<EOF
+import notmuch
+db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
+q_new = notmuch.Query(db, 'ISO-8859-2 encoded message')
+for m in q_new.search_messages():
+    for mp in m.get_message_parts():
+      continue
+    print(m.get_message_id())
+EOF
+
+notmuch search --sort=oldest-first --output=messages "tučňáččí" | sed s/^id:// > EXPECTED
+test_expect_equal_file EXPECTED OUTPUT
 
 test_done
-- 
2.14.1

  reply	other threads:[~2017-09-24 12:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24 21:30 [PATCH] python: open messages in binary mode Florian Klink
2017-08-24 22:11 ` David Bremner
2017-08-25  6:08   ` Gaute Hope
2017-08-25 10:18     ` Florian Klink
2017-09-24 12:36   ` [PATCH v2 1/2] " Florian Klink
2017-09-24 12:36     ` Florian Klink [this message]
2017-10-02 11:04     ` David Bremner
2017-10-02 11:39       ` Florian Klink
2017-10-05 15:50         ` Tomi Ollila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170924123612.26679-2-flokli@flokli.de \
    --to=flokli@flokli.de \
    --cc=andreas@rammhold.de \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).