[CalendarServer-changes] [12276] CalendarServer/branches/users/gaya/cleanrevisions/txdav/common/ datastore/work/test/test_revision_cleanup.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:24:25 PDT 2014


Revision: 12276
          http://trac.calendarserver.org//changeset/12276
Author:   gaya at apple.com
Date:     2014-01-09 13:41:38 -0800 (Thu, 09 Jan 2014)
Log Message:
-----------
fix test case works

Modified Paths:
--------------
    CalendarServer/branches/users/gaya/cleanrevisions/txdav/common/datastore/work/test/test_revision_cleanup.py

Modified: CalendarServer/branches/users/gaya/cleanrevisions/txdav/common/datastore/work/test/test_revision_cleanup.py
===================================================================
--- CalendarServer/branches/users/gaya/cleanrevisions/txdav/common/datastore/work/test/test_revision_cleanup.py	2014-01-09 03:29:50 UTC (rev 12275)
+++ CalendarServer/branches/users/gaya/cleanrevisions/txdav/common/datastore/work/test/test_revision_cleanup.py	2014-01-09 21:41:38 UTC (rev 12276)
@@ -25,6 +25,7 @@
 from txdav.common.datastore.sql_tables import  schema, _BIND_MODE_READ
 from txdav.common.datastore.test.util import buildStore, CommonCommonTests
 from txdav.common.datastore.work.revision_cleanup import FindMinValidRevisionWork
+from txdav.common.icommondatastore import SyncTokenValidException
 import datetime
 
 
@@ -212,26 +213,18 @@
         otherAB = yield self.addressbookUnderTest(home="user02", name="user01")
         self.assertNotEqual(otherAB._bindRevision, 0)
 
-        changed, deleted = yield otherAB.resourceNamesSinceRevision(0)
-        self.assertNotEqual(len(changed), 0)
-        self.assertEqual(len(deleted), 0)
-
         changed, deleted = yield otherAB.resourceNamesSinceRevision(otherAB._bindRevision)
         self.assertEqual(len(changed), 0)
         self.assertEqual(len(deleted), 0)
 
-        # TODO:  Change the groups
-
         otherHome = yield self.addressbookHomeUnderTest(name="user02")
         for depth in ("1", "infinity",):
-            changed, deleted = yield otherHome.resourceNamesSinceRevision(0, depth)
-            self.assertNotEqual(len(changed), 0)
-            self.assertEqual(len(deleted), 0)
-
             changed, deleted = yield otherHome.resourceNamesSinceRevision(otherAB._bindRevision, depth)
             self.assertEqual(len(changed), 0)
             self.assertEqual(len(deleted), 0)
 
+        yield self.commit()
+
         # Get the minimum valid revision
         cs = schema.CALENDARSERVER
         minValidRevision = int((yield Select(
@@ -242,12 +235,12 @@
         self.assertEqual(minValidRevision, 1)
 
         # queue work items
-        work = yield self.transactionUnderTest().enqueue(FindMinValidRevisionWork, notBefore=datetime.datetime.utcnow())
+        wp = yield self.transactionUnderTest().enqueue(FindMinValidRevisionWork, notBefore=datetime.datetime.utcnow())
 
-        yield self.abort()
+        yield self.commit()
 
         # Wait for it to complete
-        yield work.whenExecuted()
+        yield wp.whenExecuted()
 
         # Get the minimum valid revision again
         cs = schema.CALENDARSERVER
@@ -256,10 +249,13 @@
             From=cs,
             Where=(cs.NAME == "MIN-VALID-REVISION")
         ).on(self.transactionUnderTest()))[0][0])
-        print("test_sharedRevisions minValidRevision=%s" % (minValidRevision,))
         self.assertNotEqual(minValidRevision, 1)
 
+        otherHome = yield self.addressbookHomeUnderTest(name="user02")
+        for depth in ("1", "infinity",):
+            self.failUnlessFailure(otherHome.resourceNamesSinceRevision(otherAB._bindRevision, depth), SyncTokenValidException)
 
+
     @inlineCallbacks
     def test_sharedGroupRevisions(self):
         """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/d604d7cc/attachment.html>


More information about the calendarserver-changes mailing list