[CalendarServer-changes] [5521] CalendarServer/branches/users/wsanchez/transations/txcaldav/ calendarstore/test/test_file.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Apr 22 18:38:09 PDT 2010


Revision: 5521
          http://trac.macosforge.org/projects/calendarserver/changeset/5521
Author:   glyph at apple.com
Date:     2010-04-22 18:38:08 -0700 (Thu, 22 Apr 2010)
Log Message:
-----------
update tests to bring them closer to passing

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/transations/txcaldav/calendarstore/test/test_file.py

Modified: CalendarServer/branches/users/wsanchez/transations/txcaldav/calendarstore/test/test_file.py
===================================================================
--- CalendarServer/branches/users/wsanchez/transations/txcaldav/calendarstore/test/test_file.py	2010-04-23 00:52:10 UTC (rev 5520)
+++ CalendarServer/branches/users/wsanchez/transations/txcaldav/calendarstore/test/test_file.py	2010-04-23 01:38:08 UTC (rev 5521)
@@ -153,11 +153,12 @@
     storePath.copyTo(calendarPath)
 
     test.calendarStore = CalendarStore(calendarPath)
+    test.txn = test.calendarStore.newTransaction()
     assert test.calendarStore is not None, "No calendar store?"
 
 def setUpHome1(test):
     setUpCalendarStore(test)
-    test.home1 = test.calendarStore.calendarHomeWithUID("home1")
+    test.home1 = test.txn.calendarHomeWithUID("home1")
     assert test.home1 is not None, "No calendar home?"
 
 def setUpCalendar1(test):
@@ -192,7 +193,7 @@
         """
         Find an existing calendar home by UID.
         """
-        calendarHome = self.calendarStore.calendarHomeWithUID("home1")
+        calendarHome = self.calendarStore.newTransaction().calendarHomeWithUID("home1")
 
         self.failUnless(isinstance(calendarHome, CalendarHome))
 
@@ -201,7 +202,7 @@
         Missing calendar home.
         """
         self.assertEquals(
-            self.calendarStore.calendarHomeWithUID("xyzzy"),
+            self.calendarStore.newTransaction().calendarHomeWithUID("xyzzy"),
             None
         )
 
@@ -209,19 +210,22 @@
         """
         Create missing calendar home.
         """
-        calendarHome = self.calendarStore.calendarHomeWithUID(
+        txn = self.calendarStore.newTransaction()
+        calendarHome = txn.calendarHomeWithUID(
             "xyzzy",
             create=True
         )
 
         self.failUnless(isinstance(calendarHome, CalendarHome))
+        self.failIf(calendarHome.path.isdir())
+        txn.commit()
         self.failUnless(calendarHome.path.isdir())
 
     def test_calendarHomeWithUID_create_exists(self):
         """
         Create missing calendar home.
         """
-        calendarHome = self.calendarStore.calendarHomeWithUID("home1")
+        calendarHome = self.calendarStore.newTransaction().calendarHomeWithUID("home1")
 
         self.failUnless(isinstance(calendarHome, CalendarHome))
 
@@ -231,7 +235,7 @@
         implementation, so no UIDs may start with ".".
         """
         self.assertEquals(
-            self.calendarStore.calendarHomeWithUID("xyzzy"),
+            self.calendarStore.newTransaction().calendarHomeWithUID("xyzzy"),
             None
         )
 
@@ -343,7 +347,8 @@
         Remove an existing calendar.
         """
         for name in home1_calendarNames:
-            assert self.home1.calendarWithName(name) is not None
+            self.assertNotIdentical(self.home1.calendarWithName(name),
+                                    None)
             self.home1.removeCalendarWithName(name)
             self.assertEquals(self.home1.calendarWithName(name), None)
 
@@ -429,6 +434,7 @@
             calendar1_objectNames
         )
 
+    @testUnimplemented
     def test_calendarObjects_listdir(self):
         """
         Find all of the calendar objects using the listdir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100422/5b545877/attachment.html>


More information about the calendarserver-changes mailing list