It is more readable and returns a list therefore it is compatible both
with Python 2 and 3.
Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
an empty string appears after each literal string.
Signed-off-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Tuple are used for literal strings (see RFC3501 Section 4.3).
Signed-off-by: Pierre-Louis Bonicoli <pierre-louis.bonicoli@gmx.fr>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Make external API of class/module to be smaller, explicitely mark
all internal functions. Also annotate methods that are implemented
as the part of the parent class interface.
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This eases testing of option values inside the code. This instance
is implemented as the read-only copy of the obtained 'options' object,
so callers won't be able to modify its contents.
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
By default OfflineImap propagates new folders in both
directions. Sometimes this is not what you want. E.g. you might want
new folders on your IMAP server to propagate to your local MailDir,
but not the other way around. The 'readonly' setting on a repository
will not help here, as it prevents any change from occuring on that
repository. This is what the `createfolders` setting is for. By
default it is `True`, meaning that new folders can be created on this
repository. To prevent folders from ever being created on a
repository, set this to `False`. If you set this to False on the
REMOTE repository, you will not have to create the `Reverse
nametrans`_ rules on the LOCAL repository.
Also implement a test for this
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Add one test for each of the functions in offlineimap.imaputil, to make
sure they keep working. These functions tests the internal innards of
the offlineimap module rather than invoking offlineimap as a program.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
1) Fix test #4 by deleting all local mailfolders remaining from previous
tests, the mailfolder count will be off, otherwise.
2) Make folder deletion work in python3, it weirdly enough needs to be
quoted like this to work in python3 (I found a python bug about this
somewhere).
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This is the first test that actually creates a (local) email and
syncs. We check the result of the sync operation, to see if the
server has actually been assigning a proper UID to the email and
bail out if not.
This test therefore excercises our ability to properly detect the
new UID of an APPENDED email. Obviously we still need some
IMAP<->IMAP tests too, but since this is the same codepath being
used for APPENDs in that case, it could also help to detect
instabilities there.
In order to get this test in, the OLITestLib got a few new helper
functions:
- delete_maildir
- create_mail
- get_maildir_uids
The test passes here. I invoke it via:
python -m unittest test.tests.test_01_basic.TestBasicFunctions.test_04_createmail
or run python setup.py test, to run the whole suite.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Tests work now with python 3 with the exception of the deletion of remote
testfolders which fails for some reasons.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
We don't want to hammmer IMAP servers for the test series too much
to avoid being locked out. We will need a few tests to test
concurrent connections, but by default one connection should be fine.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
We need to clean out the remote folders before we invoke the test suite.
Implement a helper function that does this, and improve the test output
(less verbose) and the setup.py --help-commands (more verbose). Document
that it is possible to run a single test only. (although it is not
guaranteed that a test does not rely on the output of previous tests).
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
While improving the test suite, I noticed that we would not create folders on
the remote in some cases when we should (yay for test suites!). This is because
we were testing the untransposed LOCAL foldername and check if it existed on
the remote side when deciding whether we should potentially create a new folder.
Simplify the code by transposing the LOCAL folder names in dst_hash, saving us
to create another confusing "newsrc" temp variable. Make the code a bit more
readable by using dst_name_t to indicate we operate a transposed folder name.
This now passes test 03 (using invalid nametrans rules) when test 03 would pass
before.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Use get_default_config and write_config_file (which can be handed an optional
config object), so we can manipulate configuration options easily from within
the test function.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
1) Add helper functions to create and count maildirs and mails.
2) Add a second test that creates 2 maildirs, one of the including a
quotation sign " in its folder name and sync.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Don't create the temp dirs in the current directory, but create them in
the same directory as the credentials.conf file is. We still need to
prevent deleting them on test failure, so that they can be inspected
manually.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
"python setup.py test" will now run the complete test suite. Remove the
previous ./test command.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
To run the test suite from the main setup.py we need to be able to
import and run the test suite from a different folder than the "test"
dir.
Make "test" a package and fix the imports to still work when imported
from another folder.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This is the first revision that actually performs a test, in that it
starts up OfflineImap and sees if there are any exceptions.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>