Index: /main/waeup.kofa/trunk/src/waeup/kofa/tests/test_datacenter.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/tests/test_datacenter.py	(revision 8516)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/tests/test_datacenter.py	(revision 8517)
@@ -13,5 +13,6 @@
 
 
-class DataCenterTests(unittest.TestCase):
+class DataCenterLogQueryTests(unittest.TestCase):
+    # Tests for querying logfiles via datacenter.
 
     def setUp(self):
@@ -50,11 +51,4 @@
         return
 
-    def test_iface(self):
-        # we comply with interfaces
-        obj = DataCenter()
-        verifyClass(IDataCenter, DataCenter)
-        verifyObject(IDataCenter, obj)
-        return
-
     def test_query_logfiles(self):
         # We can find entries in logfiles
@@ -164,2 +158,57 @@
         self.assertEqual(result[0], 'Msg 1\n')
         return
+
+class DataCenterTests(unittest.TestCase):
+    # General datacenter tests.
+
+    def setUp(self):
+        # create a temporary place to store files
+        self.workdir = tempfile.mkdtemp()
+        self.storage = os.path.join(self.workdir, 'storage')
+        os.mkdir(self.storage)
+        self.logpath = os.path.join(self.storage, 'logs', 'myapp.log')
+        # register a datacenter config that provides the set up location
+        self.config = {'path': self.storage,}
+        self.gsm = getGlobalSiteManager()
+        self.gsm.registerUtility(self.config, IDataCenterConfig)
+        pass
+
+    def tearDown(self):
+        self.gsm.unregisterUtility(self.config, IDataCenterConfig)
+        shutil.rmtree(self.workdir)
+        return
+
+    def test_iface(self):
+        # we comply with interfaces
+        obj = DataCenter()
+        verifyClass(IDataCenter, DataCenter)
+        verifyObject(IDataCenter, obj)
+        return
+
+    def test_get_log_files(self):
+        # We can get lists of logfiles available.
+        # By default, backups are skipped.
+        datacenter = DataCenter()
+        logpath2 = self.logpath + '.1'
+        logpath3 = self.logpath + '.2'
+        for path in self.logpath, logpath2, logpath3:
+            open(path, 'wb').write('some contents')
+        result = datacenter.getLogFiles()
+        self.assertEqual(len(result), 1)
+        self.assertEqual(result[0].name, os.path.basename(self.logpath))
+        return
+
+    def test_get_log_files_incl_backups(self):
+        # We can get lists of logfiles including backup logs.
+        datacenter = DataCenter()
+        logpath2 = self.logpath + '.1'
+        logpath3 = self.logpath + '.2'
+        for path in self.logpath, logpath2, logpath3:
+            open(path, 'wb').write('some contents')
+        result = datacenter.getLogFiles(exclude_backups=False)
+        self.assertEqual(len(result), 3)
+        names = [x.name for x in result]
+        expected = [os.path.basename(x) for x in [
+            self.logpath, logpath2, logpath3]]
+        self.assertEqual(names, expected)
+        return
