Index: main/waeup.kofa/trunk/src/waeup/kofa/tests/test_configuration.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/tests/test_configuration.py	(revision 17327)
+++ main/waeup.kofa/trunk/src/waeup/kofa/tests/test_configuration.py	(revision 17782)
@@ -18,10 +18,18 @@
 """Tests for configuration containers and related.
 """
+import os
+import shutil
+import tempfile
+import unittest
+from zope.component import queryUtility
+from zope.component.hooks import setSite, clearSite
 from zope.component.interfaces import IFactory
 from zope.interface import verify
 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
+from waeup.kofa.app import University
 from waeup.kofa.configuration import (
-    ConfigurationContainer, SessionConfiguration, SessionConfigurationFactory)
-from waeup.kofa.interfaces import(
+    ConfigurationContainer, SessionConfiguration, SessionConfigurationFactory,
+    ConfigurationContainerExporter, ConfigurationExporter)
+from waeup.kofa.interfaces import(ICSVExporter,
     IConfigurationContainer, ISessionConfiguration, ISessionConfigurationAdd)
 
@@ -70,2 +78,88 @@
         implemented_by = self.factory.getInterfaces()
         assert implemented_by.isOrExtends(ISessionConfiguration)
+
+
+class ConfigurationImportExportSetup(FunctionalTestCase):
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(ConfigurationImportExportSetup, self).setUp()
+        # Setup a sample site for each test
+        app = University()
+        self.dc_root = tempfile.mkdtemp()
+        app['datacenter'].setStoragePath(self.dc_root)
+        self.getRootFolder()['app'] = app
+        self.app = self.getRootFolder()['app']
+        setSite(app)
+        self.workdir = tempfile.mkdtemp()
+        self.outfile = os.path.join(self.workdir, 'myoutput.csv')
+        return
+
+    def tearDown(self):
+        super(ConfigurationImportExportSetup, self).tearDown()
+        shutil.rmtree(self.workdir)
+        shutil.rmtree(self.dc_root)
+        clearSite()
+        return
+
+class BaseConfigurationExportTests(ConfigurationImportExportSetup):
+
+    def test_ifaces(self):
+        # make sure we fullfill interface contracts
+        obj = ConfigurationContainerExporter()
+        verify.verifyObject(ICSVExporter, obj)
+        verify.verifyClass(ICSVExporter, ConfigurationContainerExporter)
+        return
+
+    def test_get_as_utility(self):
+        # we can get a faculty exporter as utility
+        result = queryUtility(ICSVExporter, name="base_configuration")
+        self.assertTrue(result is not None)
+        return
+
+    def test_export_all(self):
+        exporter = ConfigurationContainerExporter()
+        exporter.export_all(self.app, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        self.assertTrue(
+            'acronym,captcha,carry_over,current_academic_session,email_admin,'
+            'email_subject,export_disabled_message,frontpage,frontpage_dict,'
+            'maintmode_enabled_by,name,name_admin,next_matric_integer,'
+            'next_matric_integer_2,next_matric_integer_3,'
+            'next_matric_integer_4,smtp_mailer,curr_stud_id\r\n'
+            'WAeUP.Kofa,No captcha,0,,contact@waeup.org,Kofa Contact,,'
+            '"<h1>Welcome to WAeUP.Kofa\n<br>' in result
+            )
+        return
+
+class SessionConfigurationExportTests(ConfigurationImportExportSetup):
+
+    def test_ifaces(self):
+        # make sure we fullfill interface contracts
+        obj = ConfigurationExporter()
+        verify.verifyObject(ICSVExporter, obj)
+        verify.verifyClass(ICSVExporter, ConfigurationExporter)
+        return
+
+    def test_get_as_utility(self):
+        # we can get a faculty exporter as utility
+        result = queryUtility(ICSVExporter, name="configurations")
+        self.assertTrue(result is not None)
+        return
+
+    def test_export_all(self):
+        self.sessionconfig = SessionConfiguration()
+        self.sessionconfig.academic_session = 2022
+        self.sessionconfig.clearance_fee = 3000.6
+        self.app['configuration'].addSessionConfiguration(self.sessionconfig)
+        exporter = ConfigurationExporter()
+        exporter.export_all(self.app, self.outfile)
+        result = open(self.outfile, 'rb').read()
+        self.assertEqual(result,
+            'academic_session,booking_fee,clearance_enabled,clearance_fee,'
+            'coursereg_deadline,late_registration_fee,maint_fee,'
+            'payment_disabled,transcript_fee,transfer_fee\r\n'
+            '2022,0.0,0,3000.6,,0.0,0.0,[],0.0,0.0\r\n'
+            )
+        return
