[Zope-CVS] CVS: Products/FileCacheManager/tests - testFileCacheManager.py:1.4

Jens Vagelpohl jens at dataflake.org
Fri Aug 13 07:33:49 EDT 2004


Update of /cvs-repository/Products/FileCacheManager/tests
In directory cvs.zope.org:/tmp/cvs-serv4132/tests

Modified Files:
	testFileCacheManager.py 
Log Message:
- add getters and setters for the filesystem path
- allow setting the filesystem path from the add form


=== Products/FileCacheManager/tests/testFileCacheManager.py 1.3 => 1.4 ===
--- Products/FileCacheManager/tests/testFileCacheManager.py:1.3	Fri Aug 13 05:23:17 2004
+++ Products/FileCacheManager/tests/testFileCacheManager.py	Fri Aug 13 07:33:19 2004
@@ -6,6 +6,7 @@
 
 FCM_ID = 'fcm1'
 FCM_TITLE = 'Testing FileCacheManager'
+FCM_DIR = '/tmp/foo'
 
 
 class Dummy:
@@ -28,7 +29,7 @@
 
 class FileCacheTestBase(unittest.TestCase):
     def setUp(self):
-        self.FC = FileCache()
+        self.FC = FileCache(path=FCM_DIR)
         self.f1 = Dummy(id='f1', fakepath='/spam/eggs', size=30)
         self.f2 = Dummy(id='f2', fakepath='/bacon', size=1000 * 1000)
         self.all_files = (self.f1, self.f2)
@@ -45,6 +46,14 @@
 
 class FileCacheTests(FileCacheTestBase):
 
+    def testInstantiation(self):
+        self.assertEqual(self.FC.getDir(), FCM_DIR)
+
+    def testGetSetDir(self):
+        self.assertEqual(self.FC.getDir(), FCM_DIR)
+        self.FC.setDir('/tmp')
+        self.assertEqual(self.FC.getDir(), '/tmp')
+
     def testZCache_set(self):
         for ob in self.all_files:
             self.FC.ZCache_set(ob)
@@ -87,13 +96,19 @@
 class FileCacheManagerTestBase(unittest.TestCase):
 
     def setUp(self):
-        self.FCM = FileCacheManager(FCM_ID, title=FCM_TITLE)
+        self.FCM = FileCacheManager(FCM_ID, path=FCM_DIR, title=FCM_TITLE)
 
 class FileCacheManagerTests(FileCacheManagerTestBase):
 
     def testInstantiation(self):
         self.failUnless(self.FCM.getId() == FCM_ID)
+        self.failUnless(self.FCM.getDir() == FCM_DIR)
         self.failUnless(self.FCM.title == FCM_TITLE)
+
+    def testGetSetDir(self):
+        self.failUnless(self.FCM.getDir() == FCM_DIR)
+        self.FCM.setDir('/tmp')
+        self.failUnless(self.FCM.getDir() == '/tmp')
 
     def testGetCache(self):
         c = self.FCM.ZCacheManager_getCache()



More information about the Zope-CVS mailing list