aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/maildir-sync
Commit message (Collapse)AuthorAge
* test: sanitize Date and timestamp fields in jsonGravatar David Bremner2013-12-09
| | | | | | | | | Eventually we want test messages to have distinct dates to avoid reproducability problems. This sanitization will prevent some test failures when that change is made. Replace the use of a local function in maildir-sync with notmuch_json_show_sanitize
* tags_to_maildir_flags: Don't rename if no flags changeGravatar Louis Rilling2013-09-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | notmuch_message_tags_to_maildir_flags() unconditionally moves messages from maildir directory "new/" to maildir directory "cur/", which makes messages lose their "new" status in the MUA. However some users want to keep this "new" status after, for instance, an auto-tagging of new messages. However, as Austin mentioned and according to the maildir specification, messages living in "new/" are not allowed to have flags, even if mutt allows it to happen. For this reason, this patch prevents moving messages from "new/" to "cur/", only if no flags have to be changed. It's hopefully enough to satisfy mutt (and maybe other MUAs showing the "new" status) users checking the "new" status. Changelog: * v2: Fix bool type as well as NULL returned despite having no errors (Austin Clements) * v4: Tag the related test (contributed by Michal Sojka) as working Signed-off-by: Louis Rilling <l.rilling@av7.net> [Condition for keeping messages in new/ was extended to satisfy all tests from the previous patch. -Michal Sojka] [Added by David Bremner, to keep the tests passing at each commit] update insert tests for new maildir synchronization rules As of id:1355952747-27350-4-git-send-email-sojkam1@fel.cvut.cz we are more conservative about moving messages from ./new to ./cur. This updates the insert tests to match
* test: Add some missing maildir synchronization testsGravatar Michal Sojka2013-09-03
| | | | | | As mentioned by Jani Nikula in id:87vcccp4y3.fsf@nikula.org, some cases of maildir synchronization are not covered by our tests. Let's add the missing tests.
* test: Adding non-maildir tags does not move message from new to curGravatar Michal Sojka2013-09-03
| | | | | | | | | | | | | | | | | | Some MUA's like mutt show the difference between "new" emails living in maildir directory new/, and "old" emails living in maildir directory cur/. However notmuch tag unconditionally moves selected messages from new/ to cur/, even if no maildir synchronized tag is changed. While maildir specification forbids messages with tags living in new/, there is no need to move messages to cur/ when no maildir synchronized tag is changed. Thus notmuch can remain transparent with respect to other MUA's. [ Edited commit log to better describe the intended changes, and tag the test as broken until the actual changes are implemented -- Louis Rilling ] Signed-off-by: Louis Rilling <l.rilling@av7.net> [ Converted to use test_subtest_known_broken, David Bremner ]
* notmuch-restore: replace positional argument for input with optionGravatar David Bremner2012-08-06
| | | | | Since notmuch dump doesn't use positional arguments anymore, it seems better to be consistent.
* notmuch-dump: remove deprecated positional argument for output fileGravatar David Bremner2012-08-06
| | | | | | The syntax --output=filename is a smaller change than deleting the output argument completely, and conceivably useful e.g. when running notmuch under a debugger.
* test: Remove unnecessary JSON canonicalizationGravatar Austin Clements2012-08-03
| | | | | | Format canonicalization of JSON output is no longer necessary, so remove it. Value canonicalization (e.g., normalizing thread IDs) is still necessary, so all of the sanitization functions remain.
* test: Uniformly canonicalize actual and expected JSONGravatar Austin Clements2012-08-03
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we used a variety of ad-hoc canonicalizations for JSON output in the test suite, but were ultimately very sensitive to JSON irrelevancies such as whitespace. This introduces a new test comparison function, test_expect_equal_json, that first pretty-prints *both* the actual and expected JSON and the compares the result. The current implementation of this simply uses Python's json.tool to perform pretty-printing (with a fallback to the identity function if parsing fails). However, since the interface it introduces is semantically high-level, we could swap in other mechanisms in the future, such as another pretty-printer or something that does not re-order object keys (if we decide that we care about that). In general, this patch does not remove the existing ad-hoc canonicalization because it does no harm. We do have to remove the newline-after-comma rule from notmuch_json_show_sanitize and filter_show_json because it results in invalid JSON that cannot be pretty-printed. Most of this patch simply replaces test_expect_equal and test_expect_equal_file with test_expect_equal_json. It changes the expected JSON in a few places where sanitizers had placed newlines after commas inside strings.
* lib: Treat messages in new/ as maildir messages with no flags setGravatar Austin Clements2012-06-10
| | | | | | | | | | | | Previously, notmuch new only synchronized maildir flags to tags for files with a maildir "info" part. Since messages in new/ don't have an info part, notmuch would ignore them for flag-to-tag synchronization. This patch makes notmuch consider messages in new/ to be legitimate maildir messages that simply have no maildir flags set. The most visible effect of this is that such messages now automatically get the unread tag.
* test: Add broken test for tag synchronization on files delivered to new/Gravatar Austin Clements2012-06-10
| | | | | | | | | | | | | | | | | Currently, notmuch new only synchronizes maildir flags to tags for files that have an "info" part. However, in maildir, new mail doesn't gain the info part until it moves from new/ to cur/. Hence, even though mail in new/ doesn't have an info part, it is still a maildir message and thus has maildir flags (though none of them set). The most visible effect of not synchronizing maildir flags for messages in new/ is that newly delivered messages don't get the unread tag (unless it is assigned by some other mechanism, like new.tags). This patch does *not* modify the test for messages in cur/ that do not have an "info" part. Unlike a message in new/, a message in cur/ without an info part is no longer a maildir message, and thus shouldn't be subject to maildir flag synchronization.
* test: update tests to reflect the exclude flagGravatar Mark Walters2012-03-02
| | | | | | | 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.
* show: Unify JSON header output for messages and message partsGravatar Austin Clements2012-03-01
| | | | | | | | | 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.
* test: Make generated message date a real dateGravatar Austin Clements2011-12-29
| | | | | | | | | January 5, 2001 was a Tuesday, not a Friday. Jameson fixed this exact problem for the multipart test in ec2b0a98cc, but not for generate_message itself. As Jameson pointed out in ec2b0a98cc, if we want to test date parsing, we should do it separately.
* test: Nix increment_mtime.Gravatar Austin Clements2011-06-29
| | | | | With the fix for the mtime race, this workaround is no longer necessary.
* fix sum moar typos [comments in source code]Gravatar Pieter Praet2011-06-23
| | | | | | | | | | Various typo fixes in comments within the source code. Signed-off-by: Pieter Praet <pieter@praet.org> Edited-by: Carl Worth <cworth@cworth.org> Restricted to just source-code comments, (and fixed fix of "descriptios" to "descriptors" rather than "descriptions").
* test: change "#!/bin/bash" to "#!/usr/bin/env bash" enhances portabilityGravatar Joel Borggrén-Franck2011-05-27
| | | | | | Change #!/bin/bash at start of tests to "#!/usr/bin/env bash". That way systems running on bash < 4 can prepend bash >= 4 to path before running the tests.
* tags_to_maildir_flags: Fix to preserve existing, unsupported flagsGravatar Carl Worth2010-11-11
| | | | | | This is to prevent notmuch from destroying any information the user has encoded as flags in the maildir filename. Tests are also added to the test suite to verify the documented behavior.
* notmuch_message_tags_to_maildir_flags: Do nothing outside of "new" and "cur"Gravatar Carl Worth2010-11-11
| | | | | | | | | | | Some people use notmuch with non-maildir files, (for example, email messages in MH format, or else cool things like using sluk[*] to suck down feeds into a format that notmuch can index). To better support uses like that, don't do any renaming for files that are not in a directory named either "new" or "cur". [*] https://github.com/krl/sluk/
* Enable maildir synchronization by default.Gravatar Carl Worth2010-11-11
| | | | | This is a useful feature that most people should want, so enable it by default, (still allowing customization to disable it of course).
* test: Drop test for propagating flag changes from one file to anotherGravatar Carl Worth2010-11-11
| | | | | | | | | | | There's nothing in the current API documentation that would suggest the behavior being tested here. Attempt to implement this could have some nasty side effects, (such as notmuch_message_maildir_flags_to_tags implicitly calling notmuch_message_tags_to_maildir_flags and maybe even opening up some bad looping possibilities). Much better to stick with what we have documented, which we believe will actually be useful, (and easy enough to comprehend).
* test: Add a new test that removal of a maildir flag also changes tagsGravatar Carl Worth2010-11-11
| | | | This test exposes an existing bug, so is currently failing.
* test: Rework recently-added additional maildir-sync testsGravatar Carl Worth2010-11-11
| | | | | | | | | | | | | | | These needed to be changed to be brought up to the current state of the maildir-sync tests. This includes style changes, but also the elimination of any assumption about pre-existing message filenames, (such as msg-003) which actually don't exist anymore. Also, the known broken tests are changed to emit FAIL rather than BROKEN simply to make them easier to fix, (so that they print the current problems rather than hiding them). Finally, an additional test is added to ensure that when a duplicate file is added without flags, it doesn't invalidate flags from other duplicates, (instead the flags are effectively merged).
* test: More maildir synchronization testsGravatar Michal Sojka2010-11-11
| | | | | | | | | Add maildir synchronization tests for multiple messages with the same message-id. As this is not yet implemented in notmuch, some of these teste are marked as BROKEN. I use $(< ) operator to avoid fiddling with stripped trailing newlines from test results which happens when output+=$(command) is used.
* test: Rework testing of maildir-synchronization feature.Gravatar Carl Worth2010-11-11
| | | | | | | | | | | | | | | | | | | | | | | | | | This change reworks these tests in several ways: 1. Bring tests into "new" test style preferring test_expect_equal over test_expect_success in almost all cases. 2. Don't emit test results for intermediate items not actually being tested, (things like "no new messages", "search for message", etc.). Those things are already covered by existing tests such as "basic" or "search" and only serve to obscure what's actually being tested. 3. Change sense of the test showing failure to rename a file from "new" to "cur" when "cur" doesn't exist. In this case, notmuch should detect that this is not a maildir and should not attempt to do any renaming of the file. 4. Extend dump/restore test to also exercise addition of tag, not just removal. Both items #3 and #4 above show shortcomings in the current implementation. These are currently resulting in test results of FAIL and indicate bugs that need to be fixed.
* Tests for maildir synchronizationGravatar Michal Sojka2010-11-10
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>