[CalendarServer-changes] [11587] CalendarServer/trunk/txdav/common/datastore/upgrade/test/ test_migrate.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 6 13:34:33 PDT 2013
Revision: 11587
http://trac.calendarserver.org//changeset/11587
Author: sagen at apple.com
Date: 2013-08-06 13:34:33 -0700 (Tue, 06 Aug 2013)
Log Message:
-----------
Unit test for fileStoreFromPath()
Modified Paths:
--------------
CalendarServer/trunk/txdav/common/datastore/upgrade/test/test_migrate.py
Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/test/test_migrate.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/test/test_migrate.py 2013-08-06 20:15:05 UTC (rev 11586)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/test/test_migrate.py 2013-08-06 20:34:33 UTC (rev 11587)
@@ -368,3 +368,31 @@
):
object = (yield adbk.addressbookObjectWithName(name))
self.assertEquals(object.md5(), md5)
+
+
+ def test_fileStoreFromPath(self):
+ """
+ Verify that fileStoreFromPath() will return a CommonDataStore if
+ the given path contains either "calendars" or "addressbooks"
+ sub-directories. Otherwise it returns None
+ """
+
+ # No child directories
+ docRootPath = CachingFilePath(self.mktemp())
+ docRootPath.createDirectory()
+ step = UpgradeToDatabaseStep.fileStoreFromPath(docRootPath)
+ self.assertEquals(step, None)
+
+ # "calendars" child directory exists
+ childPath = docRootPath.child("calendars")
+ childPath.createDirectory()
+ step = UpgradeToDatabaseStep.fileStoreFromPath(docRootPath)
+ self.assertTrue(isinstance(step, CommonDataStore))
+ childPath.remove()
+
+ # "addressbooks" child directory exists
+ childPath = docRootPath.child("addressbooks")
+ childPath.createDirectory()
+ step = UpgradeToDatabaseStep.fileStoreFromPath(docRootPath)
+ self.assertTrue(isinstance(step, CommonDataStore))
+ childPath.remove()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130806/83e0c8a8/attachment-0001.html>
More information about the calendarserver-changes
mailing list