]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Added a test for repeated UIDs (#44)
authorMenno Smits <menno@freshfoo.com>
Sun, 2 May 2010 15:41:38 +0000 (16:41 +0100)
committerMenno Smits <menno@freshfoo.com>
Sun, 2 May 2010 15:41:38 +0000 (16:41 +0100)
Courier IMAP sometimes repeats the UID on each line. This broke IMAPClient
0.5.2 but doesn't break 0.6. Added a test anyway to ensure this doesn't break
in the future.

imapclient/test/test_response_parser.py

index 4a7726711932be414f4ce38e6f618861a9f951cd..bc0f5af280b8fa5a21d024e2452681c3c0b461de 100644 (file)
@@ -207,6 +207,17 @@ class TestParseFetchResponse(unittest.TestCase):
                           {76: {'SEQ': 23}})
 
 
+    def test_repeated_UID(self):
+        self.assertEquals(parse_fetch_response(['23 (UID 76 FOO 123 UID 76 GOO 321)']),
+                          {76: {'FOO': 123,
+                                'GOO': 321,
+                                'SEQ': 23}})
+        self.assertEquals(parse_fetch_response(['23 (UID 76 FOO 123', 'UID 76 GOO 321)']),
+                          {76: {'FOO': 123,
+                                'GOO': 321,
+                                'SEQ': 23}})
+
+
     def test_bad_UID(self):
         self.assertRaises(ParseError, parse_fetch_response, '(UID X)')