- transparent folder escaping
- - re_folder currently fails if there's strange chars in the folder name
- - write a unit test for this
- more testing
- gmail
- cyrus
- sort out INTERNALDATE timezone issues in livetest.py (see freshfoo.com)
+- livetest.py --interact support is clumsy
+ - make this a separate command-line utility instead
+
---- release 0.5 ----
- automate releases with bzr
- clean up basic command handling to avoid repetition
- might be able to metaprogram the way out of the currently clumsy UID handling situation
- sphinx based docs
+ - publish on web site too
- support for more IMAP functions: sort, examine etc
- someone sent a patch for this?
- write a comparision of imaplib vs imapclient.py
folders = []
for line in data:
+ #TODO can the FetchParser code be adapted for use here?
folder_text = None
- #XXX write a unit test for this bug
- #XXX can the FetchParser code be used here instead?
- #if isinstance(line, tuple):
- #folder_text = line[-1]
- #else:
- m = self.re_folder.match(line)
- if m:
- folder_text = m.group(1)
+ if isinstance(line, tuple):
+ folder_text = line[-1]
+ else:
+ match = self.re_folder.match(line)
+ if match:
+ folder_text = match.group(1)
if folder_text is not None:
folders.append(self._decode_folder_name(folder_text))
return folders
import unittest
-from imapclient.test.testable_imapclient import TestableIMAPClient
+from imapclient.test.testable_imapclient import TestableIMAPClient as IMAPClient
from imapclient.test.mock import sentinel
+
class IMAPClientTestBase(unittest.TestCase):
def setUp(self):
- self.client = TestableIMAPClient()
+ self.client = IMAPClient()
class TestListFolders(IMAPClientTestBase):
self.assert_(folders == ['A', 'Foo Bar'])
+ def test_NO(self):
+ self.client._imap.list.return_value = ('NO', ['badness'])
+ self.assertRaises(IMAPClient.Error, self.client.list_folders)
+
+
def test_without_quotes(self):
self.client._imap.list.return_value = ('OK', ['(\\HasNoChildren) "/" A',
'(\\HasNoChildren) "/" B',
self.assert_(folders == ['Alpha', 'Foo Bar', 'C'], 'got %r' % folders)
-class TestListFolders(IMAPClientTestBase):
+ def test_funky_characters(self):
+ self.client._imap.list.return_value = ('OK',
+ [('(\\NoInferiors \\UnMarked) "/" {5}', 'bang\xff'),
+ '',
+ '(\\HasNoChildren \\UnMarked) "/" "INBOX"'])
+
+ folders = self.client.list_folders()
+ self.assert_(folders == ['bang\xff', 'INBOX'], 'got %r' % folders)
- def test_fail(self):
- self.assert_(False, 'todo')
if __name__ == '__main__':