Commit graph

401 commits

Author SHA1 Message Date
Adam Wolfe Gordon
30172649e8 test: Add broken test for the new JSON reply format. 2012-03-19 21:50:47 -03:00
Mark Walters
1351aafac1 test: add tests for message only search
This adds three tests for --output=messages searches. One test is for
the case when one exclude tag does not occur in the Xapian
database. This triggers a Xapian bug in some cases and causes the
whole exclusion to fail. The next commit avoids this bug.
2012-03-18 09:14:23 -03:00
Mark Walters
fb36741bf3 test: the test for the exclude code mistakenly excludes the tag "="
The tests for the exclude code in search and count use the line
    notmuch config set search.exclude_tags = deleted
which actually sets the exclude tags to be "=" and "deleted". Remove
the "=" from this line.
2012-03-18 09:14:23 -03:00
Dmitry Kurochkin
db97cb5b65 test: use subtest name for generated message subject by default
Before the change, messages generated by generate_message() used "Test
message #N" for default subject where N is the generated messages
counter.  Since message subject is commonly present in expected
results, there is a chance of breaking other tests when a new
generate_message() call is added.  The patch changes default subject
value for generated messages to subtest name if it is available.  If
subtest name is not available (i.e. message is generated during test
initialization), the old default value is used (in this case it is
fine to have the counter in the subject).

Another benefit of this change is a sane default value for subject in
generated messages, which would allow to simplify code like:

  test_begin_subtest "test for a cool feature"
  add_message [subject]="message for test for a cool feature"
2012-03-18 09:14:22 -03:00
Dmitry Kurochkin
6511b08fb8 test: remove "Generate some messages" test from raw
Before the change, the first subtest in raw format tests just
generated messages and checked that they are added successfully.  This
is not really a raw format test, it is creating of environment
required for other subtests to run.  The patch removes the first
subtest from raw and replaces it with bare add_message calls, similar
to how it is done in other tests.

TODO: we should check that test environment was created successfully.
Currently, many tests do add_message(), notmuch new and other calls
without checking the results.  We should come up with a general
solution for this, i.e. if any command during test initialization
fails, all tests should be skipped with appropriate error message.
2012-03-18 09:14:22 -03:00
Austin Clements
b1130bc71c show: Convert raw format to the new self-recursive style, properly support interior parts
This is fully compatible for root and leaf parts, but now has proper
support for interior parts.  This requires some design decisions that
were guided by what I would want if I were to save a part.
Specifically:

- Leaf parts are printed without headers and with transfer decoding.
  This is what makes sense for saving attachments.  (Furthermore, the
  transfer decoding is necessary since, without the headers, the
  caller would not be able to interpret non-transfer-decoded output.)

- Message parts are printed with their message headers, but without
  enclosing part headers.  This is what makes sense for saving a
  message as a whole (which is a message part) and for saving attached
  messages.  This is symmetric for whole messages and for attached
  messages, though we special-case the whole message for performance
  reasons (and corner-case correctness reasons: given malformed input,
  GMime may not be able to reproduce it from the parsed
  representation).

- Multipart parts are printed with their headers and all child parts.
  It's not clear what the best thing to do for multipart is, but this
  was the most natural to implement and can be justified because such
  parts can't be interpreted without their headers.

As an added benefit, we can move the special-case code for part 0 into
the raw formatter.
2012-03-18 09:14:22 -03:00
Austin Clements
046ab77b10 test: Fix malformed multipart message
Previously, there was only one CRLF between the terminating boundary
of the embedded multipart/alternative and the boundary of the
containing multipart.  However, according the RFC 1341, 7.2.1:

  The boundary must be followed immediately either by another CRLF and
  the header fields for the next part, or by two CRLFs, in which case
  there are no header fields for the next part

and

  The CRLF preceding the encapsulation line is considered part of the
  boundary so that it is possible to have a part that does not end
  with a CRLF (line break).

Thus, there must be *two* CRLFs between these boundaries: one that
ends the terminating boundary and one that begins the enclosing
boundary.

While GMime accepted the message we had before, it could not produce
such a message.
2012-03-18 09:14:21 -03:00
Austin Clements
d2e96a35a5 test: Fix typo in test description
Part 4 is a multipart, not an html part.
2012-03-18 09:14:21 -03:00
David Bremner
0c20878cce Merge branch 'release' 2012-03-13 22:09:56 -03:00
Thomas Jost
f34613ea83 build: Require gmime >= 2.6.7
gmime-2.6 had a bug [1] which made it impossible to tell why a signature
verification failed when the signer key was unavailable (empty "sigstatus" field
in the JSON output). Since 00b5623d the corresponding test is marked as broken
when using gmime-2.6 (2.4 is fine).

This bug has been fixed in gmime 2.6.5, which is now the minimal gmime-2.6
version required for building notmuch (gmime-2.4 is still available). As a
consequence the version check in test/crypto can be removed.

[Added by db]

Although less unambigously a bug, Gmime 2.6 prior to 2.6.7 also was
more strict about parsing, and rejected messages with initial "From "
headers.  This restriction is relaxed in [2].  For reasons explained in [3],
we want to keep this more relaxed parsing for now.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=668085

[2] http://git.gnome.org/browse/gmime/commit/?id=d311f576baf750476e06e9a1367a2dc1793ea7eb

[3] id:"1331385931-1610-1-git-send-email-david@tethera.net"
2012-03-11 22:13:48 -03:00
Mark Walters
c8cf9e92d8 test: update tests to reflect the exclude flag
notmuch show outputs the exclude flag so many tests using notmuch
show failed. This commit adds "excluded:0" or "excluded: false" to
the expected outputs. After this commit there should be no failing
tests.
2012-03-02 08:35:02 -04:00
Mark Walters
c440e597f9 test: update search test to reflect exclude flag
notmuch-search.c now returns all matching threads even if it the
match is a search.tag_excluded message (but with a mark indicating
this). Update the test to reflect this.
2012-03-02 08:31:42 -04:00
Mark Walters
98f5b0f09a test: add tests for new cli --no-exclude option
The tests test the new --no-exclude option to search and count.
There were no existing tests for the exclude behaviour for count so
added these too.
2012-03-02 08:25:46 -04:00
Austin Clements
86f89385c3 show: Unify JSON header output for messages and message parts
This has three ramifications:
- Blank To and Cc headers are no longer output for messages.
- Dates are now canonicalized for messages, which means they always
  have a day of the week and GMT is printed +0000 (never -0000)
- Invalid From message headers are handled slightly differently, since
  they get parsed by GMime now instead of notmuch.
2012-03-01 08:28:13 -04:00
Austin Clements
2209d7b952 show: Use consistent header ordering in the JSON format
Previously, top-level message headers were printed as Subject, From,
To, Date, while embedded message headers were printed From, To,
Subject, Date.  This makes both cases use the former order and updates
the tests accordingly.
2012-03-01 08:28:02 -04:00
Daniel Schoepe
6e25ea031f emacs: Tests for user-defined sections
A new file was added for notmuch-hello tests.
2012-03-01 08:16:55 -04:00
Michal Sojka
1093c24dcc test: Remove 'broken' flag from encoding test 2012-02-29 07:41:55 -04:00
Michal Sojka
74f8f15adc test: Add test for searching of uncommonly encoded messages
Emails that are encoded differently than as ASCII or UTF-8 are not
indexed properly by notmuch. It is not possible to search for non-ASCII
words within those messages.
2012-02-29 07:34:54 -04:00
Austin Clements
17a06ab990 emacs: Reverse the meaning of notmuch-show-refresh-view's argument
Consensus seems to be that people prefer that refreshing show buffers
retains state by default, rather than resetting it by default.  This
turns out to be the case in the code, as well.  In fact, there's even
a test for this that's been marked broken for several months, which
this patch finally gets to mark as fixed.
2012-02-25 10:35:22 -04:00
Pieter Praet
2f86290aaf emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
* emacs/notmuch-show.el

  (notmuch-show-stash-mlarchive-link-alist):
    New defcustom of type `alist' (key = name, value = URI),
    containing Mailing List Archive URI's for searching by Message-Id.

  (notmuch-show-stash-mlarchive-link-default):
    New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link'
    received no user input whatsoever.  Available choices are generated using
    the contents of `notmuch-show-stash-mlarchive-link-alist'.

  (notmuch-show-stash-map):
    Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link'
    respectively `notmuch-show-stash-mlarchive-link-and-go'.

  (notmuch-show-stash-mlarchive-link):
    New function, stashes a URI pointing to the current message at one
    of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.
    Prompts user with `completing-read' if not provided with an MLA key.

  (notmuch-show-stash-mlarchive-link-and-go):
    New function, uses `notmuch-show-stash-mlarchive-link' to
    stash a URI, and then visits it using the browser configured
    in `browse-url-browser-function'.

Based on original work [1] by David Edmondson <dme@dme.org>.

[1] id:"1327397873-20596-1-git-send-email-dme@dme.org"
2012-02-25 10:34:27 -04:00
Pieter Praet
e2a68f9941 test: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List Archive URIs
`notmuch-show-stash-mlarchive-link' stashes a URI pointing to the current message
at one of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.

Marked as "broken": fixed in next commit.
2012-02-25 10:34:16 -04:00
Pieter Praet
b32831e5b8 test: replace occurrences of $PWD with vars that are more stable
Thanks to Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
for pointing this out:  id:"87d39ymyb4.fsf@gmail.com"
2012-02-25 08:48:47 -04:00
Pieter Praet
e3fb62f59b test: always report missing prereqs, independent of `--verbose' option
When tests are skipped due to missing prereqs, those prereqs are only
displayed when running with the `--verbose' option.  This is essential
information when troubleshooting, so always send to stdout.
2012-02-20 23:24:20 -04:00
Tomi Ollila
ce1e720de6 add support for user-specified files & directories to ignore
A new configuration key 'new.ignore' is used to determine which
files and directories user wants not to be scanned as new mails.

Mark the corresponding test as no longer broken.
This work merges my previous attempts and Andreas Amann's work
in id:"ylp7hi23mw8.fsf@tyndall.ie"
2012-02-17 08:04:34 -04:00
Tomi Ollila
863c149514 test: add tests wrt ignoring user-specified files and directories
Files and directories which are specified in 'new.ignore' in the
config file shouldn't be indexed nor reported by `notmuch new'.

This is basically Pieter's work with Austin's comments addressed.
2012-02-17 08:04:23 -04:00
Austin Clements
c0cd090412 show: Simplify new text formatter code
This makes the text formatter take advantage of the new code
structure.  The previously duplicated header logic is now unified,
several things that we used to compute repeatedly across different
callbacks are now computed once, and the code is simpler overall and
32% shorter.

Unifying the header logic causes this to format some dates slightly
differently, so the two affected test cases are updated.
2012-02-12 11:58:20 -05:00
Dmitry Kurochkin
8d26b8eaac test: remove explicit loading of elisp tests in emacs-address-cleaning
It is no longer needed, since elisp tests files are auto loaded now.
2012-02-12 11:58:20 -05:00
Dmitry Kurochkin
754ddbb578 test: auto load elisp tests file in test_emacs if available
This allows us to simplify shell part of tests written in elisp.
2012-02-12 11:58:20 -05:00
Dmitry Kurochkin
148a96c43d test: fix emacs tests after tagging operations changes
After the recent tagging operations changes, functions bound to "+"
and "-" in notmuch-search and notmuch-show views always read input
from the minibuffer.  Use kbd macros instead of calling them directly.
2012-02-08 11:14:10 -04:00
David Bremner
57702cc430 test: Fix up date in MML quoting tests.
based on id:"1328264649-27346-3-git-send-email-pieter@praet.org"

Commit 66ecd9063 made dates "real", but it hasn't hit release yet.
2012-02-04 13:37:33 -05:00
David Bremner
d43f6c00b3 Merge commit '0.11.1'
Conflicts:
	NEWS
	bindings/python/notmuch/database.py
	bindings/python/notmuch/message.py
	notmuch.1

NEWS merged by hand, others taken from master.
2012-02-04 12:01:46 -05:00
Dmitry Kurochkin
8281430558 emacs: fix `notmuch-wash-region-to-button' to work at beginning of buffer
`Notmuch-wash-region-to-button' is the function that creates hidden
regions with buttons for signatures, citations and original messages.
Before the change, it did not work correctly if the to-be-hidden
region started at the beginning of a message: the visibility toggle
button was hidden as well.  The patch fixes this.  There are two parts
in the fix:

* Use `insert-before-markers' instead of `insert' for creating the
  button, so that it does not get added to the hidden overlay.

* Stop using PREFIX argument for adding a newline before the button.
  The newline should not be added before a button at the beginning of
  buffer.

The corresponding test is fixed now.
2012-02-04 07:33:18 -05:00
Dmitry Kurochkin
69adeb52b1 test: add test for hiding Original Message region at beginning of a message
The test is currently broken and will be fixed by a subsequent patch.

The patch adds a new file for tests of Emacs notmuch-show view.

Based on patch by David Edmondson [1].

[1] id:"1327562380-12894-4-git-send-email-dme@dme.org"
2012-02-04 07:32:54 -05:00
David Edmondson
32d7b3aabd emacs: More address cleaning.
Remove outer single-quotes from the mailbox part. Allow for multiple
sets of nested single and double quotes.

Add more tests.
2012-02-03 21:24:48 -04:00
Dmitry Kurochkin
6dec2af55b test: remove ".sh" extension from the recently added Emacs tests
All test files, except for the recently added Emacs tests, do not have
".sh" extension.  So remove it from the new test files for consistency.
2012-02-03 21:12:12 -04:00
Aaron Ecay
ae438ccd8c emacs: quote MML tags in replies
Emacs message-mode uses certain text strings to indicate how to attach
files to outgoing mail.  If these are present in the text of an email,
and a user is tricked into replying to the message, the user’s files
could be exposed.

Edited-by: Pieter Praet <pieter@praet.org>:  Rebased to release branch.
2012-02-03 08:26:41 -04:00
Aaron Ecay
3f2050ac22 test: add tests for quoting of MML tags in replies
The test is broken at this time; the next commit will introduce a fix.

Edited-by: Pieter Praet <pieter@praet.org>:
  Rebased to release branch, moved expected output into the actual test,
  and fixed "Fcc:" line.
2012-02-03 08:26:27 -04:00
David Edmondson
cd03f21447 emacs: Another special case for `notmuch-show-clean-address'.
Remove backslashes.
2012-01-27 07:59:40 -04:00
David Edmondson
50d65de394 test: Updated expected output for new `notmuch-show-clean-address'. 2012-01-27 07:59:23 -04:00
David Edmondson
cbc4876a33 emacs: Avoid mail-header-parse-address' in notmuch-show-clean-address'.
`mail-header-parse-address' expects un-decoded mailbox parts, which is
not what we have at this point. Replace it with simple string
deconstruction.

Mark the corresponding test as no longer broken.

Minor whitespace cleanup.
2012-01-27 07:58:58 -04:00
David Edmondson
2f50524e27 test: `notmuch-test-run' should protect against buffer switching.
The body of the test may cause the current buffer to change. Ensure
that the output goes to the correct buffer by switching back before
inserting it.
2012-01-26 08:35:15 -04:00
David Edmondson
c70c7f86b8 test: `visible-buffer-substring' should not return text properties.
When using `visible-buffer-substring' to examine a buffer, the text
properties are not useful, so don't include them.
2012-01-26 08:35:02 -04:00
Dmitry Kurochkin
d0a048f856 emacs: polish notmuch-hello help text
Make `=' binding description consistent with others.
2012-01-26 08:20:40 -04:00
Dmitry Kurochkin
02d8815922 emacs: bind "s" to `notmuch-search' in notmuch-hello buffer
Before the change, "s" in notmuch-hello buffer would jump to the
search box.  The patch changes the binding to `notmuch-search' which
is consistent with all other notmuch buffers.
2012-01-25 08:33:27 -04:00
David Edmondson
3699fedb3a test: Add address cleaning tests. 2012-01-25 07:27:01 -04:00
David Edmondson
f92d7dee8f test: Add more helpers for emacs tests. 2012-01-25 07:26:47 -04:00
David Edmondson
260975e8af test: Add `test_emacs_expect_t'.
Add a new test function to allow simpler testing of emacs
functionality.

`test_emacs_expect_t' takes one argument - a lisp expression to
evaluate. The test passes if the expression returns `t', otherwise it
fails and the output is reported to the tester.
2012-01-25 07:25:44 -04:00
David Edmondson
2903b32f79 test: Don't return the result of checking for running emacs to the tester.
When checking for a running emacs, test_emacs evaluates the empty list
'()'. This returns 'nil' when emacs is running, which is then
prepended to the actual test result. Given that it is not part of the
actual test output the test harness can incorrectly report test
failure (or success).
2012-01-25 07:25:25 -04:00
Pieter Praet
ba33a15ec3 config: only exclude messages if 'search.exclude_tags' is explicitly set
Currently, the 'search.exclude_tags' option is automatically
set to "deleted;spam;" if it's missing from the config file.

This violates the Principle of Least Surprise, so *only* set
'search.exclude_tags' to "deleted;spam;" if we didn't find a
configuration file at all.

This patch is actually Austin Clements' work:
  id:"20120117203211.GQ16740@mit.edu"
2012-01-23 19:21:18 -04:00
Pieter Praet
6795c62a50 test: only exclude "deleted" messages from search if explicitly configured
Currently, the 'search.exclude_tags' option is automatically set to
"deleted;spam;" if it's missing from the config file.

This violates the Principle of Least Surprise, so update the tests to
*only* expect the exclusion of messages which are tagged "deleted" if the
'search.exclude_tags' option is explicitly set *and* contains that tag.
2012-01-23 19:19:26 -04:00