[CalendarServer-changes] [13285] CalendarServer/trunk/txdav/who/test/test_groups.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 15 14:31:50 PDT 2014


Revision: 13285
          http://trac.calendarserver.org//changeset/13285
Author:   sagen at apple.com
Date:     2014-04-15 14:31:50 -0700 (Tue, 15 Apr 2014)
Log Message:
-----------
Try to reproduce the exception when groupByUID() is called multiple times

Modified Paths:
--------------
    CalendarServer/trunk/txdav/who/test/test_groups.py

Modified: CalendarServer/trunk/txdav/who/test/test_groups.py
===================================================================
--- CalendarServer/trunk/txdav/who/test/test_groups.py	2014-04-15 21:17:20 UTC (rev 13284)
+++ CalendarServer/trunk/txdav/who/test/test_groups.py	2014-04-15 21:31:50 UTC (rev 13285)
@@ -35,6 +35,22 @@
 
 
     @inlineCallbacks
+    def test_multipleCalls(self):
+        """
+        Ensure multiple calls to groupByUID() don't raise an exception
+        """
+
+        store = self.storeUnderTest()
+        txn = store.newTransaction()
+
+        record = yield self.directory.recordWithUID(u"__top_group_1__")
+        groupID, name, membershipHash, modified = (yield txn.groupByUID(record.uid))
+        groupID, name, membershipHash, modified = (yield txn.groupByUID(record.uid))
+
+        yield txn.commit()
+
+
+    @inlineCallbacks
     def test_refreshGroup(self):
         """
         Verify refreshGroup() adds a group to the Groups table with the
@@ -74,7 +90,9 @@
         groups = (yield self.groupCacher.cachedGroupsFor(txn, record.uid))
         self.assertEquals(set([u"__top_group_1__"]), groups)
 
+        yield txn.commit()
 
+
     @inlineCallbacks
     def test_synchronizeMembers(self):
         """
@@ -123,7 +141,9 @@
         records = (yield self.groupCacher.cachedMembers(txn, groupID))
         self.assertEquals(len(records), 0)
 
+        yield txn.commit()
 
+
     @inlineCallbacks
     def test_groupByID(self):
 
@@ -140,7 +160,9 @@
         results = (yield txn.groupByID(groupID))
         self.assertEquals((uid, u"Top Group 1", hash), results)
 
+        yield txn.commit()
 
+
     @inlineCallbacks
     def test_externalAssignments(self):
 
@@ -310,7 +332,9 @@
             )
         )
 
+        yield txn.commit()
 
+
     def test_diffAssignments(self):
         """
         Ensure external proxy assignment diffing works
@@ -390,4 +414,3 @@
                 {"D": ("7", "8"), "C": ("4", "5"), "A": ("1", "2")},
             )
         )
-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140415/8b3d73ab/attachment.html>


More information about the calendarserver-changes mailing list