[Commits] (pavlov) adding additional tests for item collections

commits at osafoundation.org commits at osafoundation.org
Fri Aug 20 11:39:25 PDT 2004


Commit by: pavlov
Modified files:
chandler/parcels/osaf/framework/webdav/TestDAV.py 1.5 1.6

Log message:
adding additional tests for item collections


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/webdav/TestDAV.py.diff?r1=text&tr1=1.5&r2=text&tr2=1.6

Index: chandler/parcels/osaf/framework/webdav/TestDAV.py
diff -u chandler/parcels/osaf/framework/webdav/TestDAV.py:1.5 chandler/parcels/osaf/framework/webdav/TestDAV.py:1.6
--- chandler/parcels/osaf/framework/webdav/TestDAV.py:1.5	Thu Aug 19 13:32:55 2004
+++ chandler/parcels/osaf/framework/webdav/TestDAV.py	Fri Aug 20 11:39:24 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.5 $"
-__date__      = "$Date: 2004/08/19 20:32:55 $"
+__revision__  = "$Revision: 1.6 $"
+__date__      = "$Date: 2004/08/20 18:39:24 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -19,46 +19,57 @@
 
     def testGeneratedEvents(self):
 
+        if not self.isOnline():
+            return
+
         self.loadParcel("http://osafoundation.org/parcels/osaf/framework/webdav")
         self.loadParcel("http://osafoundation.org/parcels/osaf/contentmodel/calendar")
         self.loadParcel("http://osafoundation.org/parcels/osaf/contentmodel")
 
-        return
-
-        # this should return None
-        #DAV('http://code-bear.com/dav/this_item_doesnt_exist').get()
-
-        """ item exporting """
-        testItem = GenerateItems.GenerateCalendarEvent(100)
-        url = 'http://code-bear.com/dav/' + 'my_test_item' #testItem.itsUUID.str16()
-        a = DAV(url)
-        print 'put 1'
-        a.put(testItem)
-        print 'put 2'
-        a.put(testItem)
-
-        """ item fetching """
-        # fetch the item we put above
-        testItem = DAV(url).get()
-        testItem2 = DAV(url).get()
-        testItem3 = DAV(url).get()
+        test404 = 0
+        testPutGetItem = 0
+        testExportCollection = 0
+        testSyncCollection = 0
+
+        if test404:
+            noneItem = DAV('http://code-bear.com/dav/this_item_doesnt_exist').get()
+            self.assert_(noneItem == None)
+
+        if testPutGetItem:
+            # item exporting
+            testItem = GenerateItems.GenerateCalendarEvent(100)
+            a = DAV('http://code-bear.com/dav/my_test_item')
+
+            a.deleteResource()
+            a.put(testItem)
+
+            """ item fetching """
+            testItem = a.get()
+
+            print testItem
+
+
+        if testExportCollection:
+            # export item collections
+            ic = ItemCollection.NamedCollection()
+            for index in range(3):
+                ic.add(GenerateItems.GenerateCalendarEvent(100))
+
+            a = DAV('http://code-bear.com/dav/test_item_collection2')
+            a.deleteResource()
+            a.put(ic)
+
+        if testSyncCollection:
+            # try fetching the item collection.  it shouldn't have any changes
+            a = DAV('http://code-bear.com/dav/test_item_collection2')
+            ic = a.get()
+            print '----------' + str(len(ic)) + '----------'
 
-
-
-        print testItem, testItem2, testItem3
-
-        
-        """ export item collections """
-        """
-        ic = ItemCollection.NamedCollection()
-        for index in range(5):
+            # add new event to collection, commit, sync
             ic.add(GenerateItems.GenerateCalendarEvent(100))
+            self.rep.commit()
 
-        a = DAV('http://code-bear.com/dav/' + str(ic.itsUUID)).putCollection(ic)
-
-        newCollection = DAV(a).getCollection(ic)
-        """
-        self.rep.commit()
+            a.sync(ic)
 
 if __name__ == "__main__":
     unittest.main()



More information about the Commits mailing list