aboutsummaryrefslogtreecommitdiffstats
path: root/test_archivemail
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2010-09-26 20:17:53 +0200
committerNikolaus Schulz <microschulz@web.de>2010-09-26 21:28:54 +0200
commiteb8bc7a4ec1b5ca19a4b50040d96eb8b1024fd34 (patch)
tree6548797654a8b4255acf5ca31e7ef98e965b09af /test_archivemail
parentb7091e90eaa082f74626a10b7c33dfed090770bf (diff)
downloadarchivemail-eb8bc7a4ec1b5ca19a4b50040d96eb8b1024fd34.tar.gz
archivemail-eb8bc7a4ec1b5ca19a4b50040d96eb8b1024fd34.tar.bz2
archivemail-eb8bc7a4ec1b5ca19a4b50040d96eb8b1024fd34.zip
IMAP: correctly handle IMAP `literal' and unquoted `astring' in LIST reply
The LIST reply handling in imap_find_mailboxes() was buggy in several ways. It expected a non-NIL hierarchy delimiter, and it assumed that the mailbox name in a LIST reply is always quoted; but it can be an astring, a quoted string, or a literal (see RFC 3501 for the definitions of these tokens). These variants should now all be interpreted correctly. In addition, quoted mailbox names are now handled more strictly to the letter of the RFC; this only affects mailbox names containing a " or a backslash, though.
Diffstat (limited to 'test_archivemail')
-rwxr-xr-xtest_archivemail20
1 files changed, 20 insertions, 0 deletions
diff --git a/test_archivemail b/test_archivemail
index c49508f..6fff170 100755
--- a/test_archivemail
+++ b/test_archivemail
@@ -617,6 +617,26 @@ class TestParseIMAPUrl(unittest.TestCase):
archivemail.options.verbose = False
archivemail.options.pwfile = None
+########## quoting and un-quoting of IMAP strings ##########
+
+class TestIMAPQuoting(unittest.TestCase):
+ stringlist = (
+ ('{braces} and space', '"{braces} and space"'),
+ ('\\backslash', '"\\\\backslash"'),
+ ('with "quotes" inbetween', '"with \\"quotes\\" inbetween"'),
+ ('ending with "quotes"', '"ending with \\"quotes\\""'),
+ ('\\"backslash before quote', '"\\\\\\"backslash before quote"')
+ )
+
+ def testQuote(self):
+ for unquoted, quoted in self.stringlist:
+ self.assertEqual(archivemail.imap_quote(unquoted), quoted)
+
+ def testUnquote(self):
+ for unquoted, quoted in self.stringlist:
+ self.assertEqual(unquoted, archivemail.imap_unquote(quoted))
+
+
########## acceptance testing ###########
class TestArchive(TestCaseInTempdir):