]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Made XLIST test more robust
authorMenno Smits <menno@freshfoo.com>
Tue, 24 Sep 2013 22:20:14 +0000 (23:20 +0100)
committerMenno Smits <menno@freshfoo.com>
Tue, 24 Sep 2013 22:20:14 +0000 (23:20 +0100)
Don't assume that the first item returned will be for the inbox.

imapclient/livetest.py

index c02fa0281210a0a243d681114dc01fb0d27d6e78..909dabaff1ea879b7c5e90674a2529beec67f891 100644 (file)
@@ -232,11 +232,14 @@ class TestGeneral(_TestBase):
 
         result = self.client.xlist_folders()
         self.assertGreater(len(result), 0, 'No folders returned by XLIST')
+
+        foundInbox = False
         for flags, _, _  in result:
-            if '\\INBOX' in [flag.upper() for flag in flags]:
+            if r'\INBOX' in [flag.upper() for flag in flags]:
+                foundInbox = True
                 break
-            else:
-                self.fail('INBOX not returned in XLIST output')
+        if not foundInbox:
+            self.fail('INBOX not returned in XLIST output')
 
     def test_subscriptions(self):
         folders = self.add_prefix_to_folders([