From: Menno Smits Date: Tue, 30 Jun 2015 09:25:18 +0000 (+1200) Subject: CONDSTORE live test is now more reliable X-Git-Tag: 0.13 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=ea5444653268c1edf548253ab06a601a7f30b41f;p=imapclient.git CONDSTORE live test is now more reliable ... especially on Gmail. Don't assume that adding a message will increment the MODSEQ by just 1. Fixes #129. --HG-- branch : stable --- diff --git a/NEWS.rst b/NEWS.rst index d721508..4361bd5 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -31,10 +31,12 @@ called datetime_to_INTERNALDATE. This will only affect you in the unlikely case that you were importing this function out of the IMAPClient package. -Documentation Updates ---------------------- -The docs for various IMAPClient methods, and the HACKING.rst file have -been updated. +Other +----- + * The docs for various IMAPClient methods, and the HACKING.rst file + have been updated. + * CONDSTORE live test is now more reliable (especially when running + against Gmail) ====== 0.12 diff --git a/imapclient/livetest.py b/imapclient/livetest.py index 4797d61..f8325af 100644 --- a/imapclient/livetest.py +++ b/imapclient/livetest.py @@ -739,15 +739,26 @@ def createUidTestClass(conf, use_uid): self.client.close_folder() self.clear_folder(self.base_folder) + # # Actual testing starts here - maxModSeq = self.client.select_folder(self.base_folder)[b'HIGHESTMODSEQ'] + # + + # Get the starting MODSEQ + modseq = self.client.select_folder(self.base_folder)[b'HIGHESTMODSEQ'] + + # Add a message so that the MODSEQ gets bumped self.append_msg(SIMPLE_MESSAGE) msg_id = self.client.search()[0] - resp = self.client.fetch(msg_id, ['FLAGS'], ['CHANGEDSINCE %d' % maxModSeq]) - self.assertIn(b'MODSEQ', resp[msg_id]) - # Prove that the modifier is actually being used - resp = self.client.fetch(msg_id, ['FLAGS'], ['CHANGEDSINCE %d' % (maxModSeq + 1)]) + # Request changes since the starting MODSEQ: this should + # return the new message. + resp = self.client.fetch(msg_id, ['FLAGS'], ['CHANGEDSINCE %d' % modseq]) + new_modseq = resp[msg_id][b"MODSEQ"][0] + self.assertGreater(new_modseq, modseq) + + # Now asked for changes since the MODSEQ on the added + # message. These shouldn't be any. + resp = self.client.fetch(msg_id, ['FLAGS'], ['CHANGEDSINCE %d' % new_modseq]) self.assertEqual(resp, {}) def test_BODYSTRUCTURE(self):