[CalendarServer-changes] [5977] CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore /test/common.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 4 13:12:55 PDT 2010


Revision: 5977
          http://trac.macosforge.org/projects/calendarserver/changeset/5977
Author:   glyph at apple.com
Date:     2010-08-04 13:12:53 -0700 (Wed, 04 Aug 2010)
Log Message:
-----------
make tests clean up after their transactions

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/common.py

Modified: CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/common.py
===================================================================
--- CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/common.py	2010-08-04 20:08:16 UTC (rev 5976)
+++ CalendarServer/branches/users/glyph/sql-store/txcaldav/calendarstore/test/common.py	2010-08-04 20:12:53 UTC (rev 5977)
@@ -156,6 +156,7 @@
                 "2.ics": cal1Root.child("2.ics").getContent(),
                 "3.ics": cal1Root.child("3.ics").getContent()
             },
+            "calendar_2": {},
             "calendar_empty": {},
             "not_a_calendar": None
         },
@@ -267,7 +268,7 @@
         L{ICommonStoreTransaction}, L{ICalendarTransaction}, and their
         respectively required attributes.
         """
-        txn = self.storeUnderTest().newTransaction()
+        txn = self.transactionUnderTest()
         self.assertProvides(ICommonTransaction, txn)
         self.assertProvides(ICalendarTransaction, txn)
 
@@ -302,9 +303,8 @@
         provides L{ICalendarHome} and has a C{uid()} method that returns the
         same value that was passed in.
         """
-        calendarHome = (self.storeUnderTest().newTransaction()
+        calendarHome = (self.transactionUnderTest()
                         .calendarHomeWithUID("home1"))
-
         self.assertEquals(calendarHome.uid(), "home1")
         self.assertProvides(ICalendarHome, calendarHome)
 
@@ -314,11 +314,8 @@
         L{ICommonStoreTransaction.calendarHomeWithUID} should return C{None}
         when asked for a non-existent calendar home.
         """
-        self.assertEquals(
-            self.storeUnderTest().newTransaction()
-            .calendarHomeWithUID("xyzzy"),
-            None
-        )
+        txn = self.transactionUnderTest()
+        self.assertEquals(txn.calendarHomeWithUID("xyzzy"), None)
 
 
     def test_calendarWithName_exists(self):
@@ -329,6 +326,8 @@
         home = self.homeUnderTest()
         for name in home1_calendarNames:
             calendar = home.calendarWithName(name)
+            if calendar is None:
+                self.fail("calendar %r didn't exist" % (name,))
             self.assertProvides(ICalendar, calendar)
             self.assertEquals(calendar.name(), name)
 
@@ -667,17 +666,13 @@
         L{CalendarObjectNameAlreadyExistsError} if a calendar object with the
         given name already exists in that calendar.
         """
-        print 'getting calendar under test'
         cal = self.calendarUnderTest()
-        print 'parsing component'
         comp = VComponent.fromString(event4_text)
-        print 'checking raise'
         self.assertRaises(
             ObjectResourceNameAlreadyExistsError,
             cal.createCalendarObjectWithName,
             "1.ics", comp
         )
-        print 'done'
 
 
     def test_createCalendarObjectWithName_invalid(self):
@@ -732,8 +727,9 @@
             create=True
         )
         def readOtherTxn():
-            return self.savedStore.newTransaction().calendarHomeWithUID(
-                noHomeUID)
+            otherTxn = self.savedStore.newTransaction()
+            self.addCleanup(otherTxn.commit)
+            return otherTxn.calendarHomeWithUID(noHomeUID)
         self.assertProvides(ICalendarHome, calendarHome)
         # A concurrent transaction shouldn't be able to read it yet:
         self.assertIdentical(readOtherTxn(), None)
@@ -886,7 +882,7 @@
     def test_dropboxID(self):
         """
         L{ICalendarObject.dropboxID} should synthesize its dropbox from the X
-        -APPLE-DROPBOX property.
+        -APPLE-DROPBOX property, if available.
         """
         cal = self.calendarUnderTest()
         cal.createCalendarObjectWithName("drop.ics", VComponent.fromString(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100804/b73ccc53/attachment.html>


More information about the calendarserver-changes mailing list