Index: in/waeup.custom/trunk/src/waeup/custom/students/tests.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/students/tests.py	(revision 7891)
+++ 	(revision )
@@ -1,181 +1,0 @@
-## $Id$
-##
-## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##
-import os
-import shutil
-import tempfile
-from hurry.workflow.interfaces import IWorkflowState
-from zope.component.hooks import setSite, clearSite
-from waeup.kofa.app import University
-from waeup.kofa.students.tests.test_browser import StudentsFullSetup
-from waeup.kofa.testing import FunctionalTestCase
-from waeup.kofa.students.batching import StudentProcessor as StudentProcessorBase
-from waeup.custom.students.batching import StudentProcessor
-from waeup.custom.testing import FunctionalLayer
-from waeup.custom.configuration import SessionConfiguration
-
-STUDENT_SAMPLE_DATA = open(
-    os.path.join(os.path.dirname(__file__), 'sample_student_data.csv'),
-    'rb').read()
-
-STUDENT_HEADER_FIELDS = STUDENT_SAMPLE_DATA.split(
-    '\n')[0].split(',')
-
-class StudentImporterTest(FunctionalTestCase):
-    """Perform some batching tests.
-    """
-
-    layer = FunctionalLayer
-
-    def setUp(self):
-        super(StudentImporterTest, self).setUp()
-        # Setup a sample site for each test
-        app = University()
-        self.dc_root = tempfile.mkdtemp()
-        app['datacenter'].setStoragePath(self.dc_root)
-
-        # Prepopulate the ZODB...
-        self.getRootFolder()['app'] = app
-        # we add the site immediately after creation to the
-        # ZODB. Catalogs and other local utilities are not setup
-        # before that step.
-        self.app = self.getRootFolder()['app']
-        # Set site here. Some of the following setup code might need
-        # to access grok.getSite() and should get our new app then
-        setSite(app)
-
-        self.importer_base = StudentProcessorBase()
-        self.importer = StudentProcessor()
-        self.workdir = tempfile.mkdtemp()
-        self.csv_file = os.path.join(self.workdir, 'sample_student_data.csv')
-        open(self.csv_file, 'wb').write(STUDENT_SAMPLE_DATA)
-
-    def tearDown(self):
-        super(StudentImporterTest, self).tearDown()
-        shutil.rmtree(self.workdir)
-        shutil.rmtree(self.dc_root)
-        clearSite()
-        return
-
-    def test_import(self):
-        # We added empty columns 'nationality' and 'lga' to the import file.
-        # The original importer will fail because these fields are required
-        # in the base package.
-        num, num_warns, fin_file, fail_file = self.importer_base.doImport(
-            self.csv_file, STUDENT_HEADER_FIELDS)
-        self.assertEqual(num_warns,3)
-        assert len(self.app['students'].keys()) == 0
-        # The customized importer does not complain since both fields are
-        # not required in the custom package.
-        num, num_warns, fin_file, fail_file = self.importer.doImport(
-            self.csv_file, STUDENT_HEADER_FIELDS)
-        self.assertEqual(num_warns,0)
-        assert len(self.app['students'].keys()) == 3
-        shutil.rmtree(os.path.dirname(fin_file))
-
-
-class StudentUITests(StudentsFullSetup):
-    """Tests for customized student class views and pages
-    """
-
-    layer = FunctionalLayer
-
-    def callback_url(self, payment_url, resp, apprAmt):
-        return payment_url + (
-            '/callback?echo=' +
-            '&resp=%s' +
-            '&desc=Something went wrong' +
-            '&txnRef=p1331792385335' +
-            '&payRef=' + '&retRef=' +
-            '&cardNum=0' +
-            '&apprAmt=%s' +
-            '&url=http://xyz') % (resp, apprAmt)
-
-    def test_manage_payments(self):
-        # Add missing configuration data
-        self.app['configuration']['2004'].gown_fee = 150
-        self.app['configuration']['2004'].transfer_fee = 90
-        self.app['configuration']['2004'].clearance_fee = 120
-        self.app['configuration']['2004'].maint_fee = 180
-
-        # Managers can add online payment tickets
-        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
-        self.browser.open(self.payments_student_path)
-        self.browser.getControl("Add online payment ticket").click()
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Amount could not be determined...',
-                           self.browser.contents)
-        IWorkflowState(self.student).setState('cleared')
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        ctrl = self.browser.getControl(name='val_id')
-        value = ctrl.options[0]
-        self.browser.getLink(value).click()
-        self.assertMatches('...Amount Authorized...',
-                           self.browser.contents)
-        # Set ticket paid
-        ticket = self.student['payments'].items()[0][1]
-        ticket.p_state = 'paid'
-        IWorkflowState(self.student).setState('returning')
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...This type of payment has already been made...',
-                           self.browser.contents)
-        # Remove all payments so that we can add a school fee payment again
-        keys = [i for i in self.student['payments'].keys()]
-        for payment in keys:
-            del self.student['payments'][payment]
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['gown']
-        self.browser.getControl("Create ticket").click()
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['transfer']
-        self.browser.getControl("Create ticket").click()
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl(
-            name="form.p_category").value = ['bed_allocation']
-        self.browser.getControl("Create ticket").click()
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl(
-            name="form.p_category").value = ['hostel_maintenance']
-        self.browser.getControl("Create ticket").click()
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['clearance']
-        self.browser.getControl("Create ticket").click()
-        self.certificate.study_mode = 'ug_pt'
-        self.browser.open(self.payments_student_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['schoolfee']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Amount could not be determined...',
-                           self.browser.contents)
-
-        # If the session configuration doesn't exist and error message will
-        # be shown
-        del self.app['configuration']['2004']
-        self.browser.open(self.payments_student_path)
-        self.browser.getControl("Add online payment ticket").click()
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Session configuration object is not...',
-                           self.browser.contents)
-
-
Index: /main/waeup.custom/trunk/src/waeup/custom/students/tests/browser_test.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/students/tests/browser_test.py	(revision 7892)
+++ /main/waeup.custom/trunk/src/waeup/custom/students/tests/browser_test.py	(revision 7892)
@@ -0,0 +1,181 @@
+## $Id$
+##
+## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+import os
+import shutil
+import tempfile
+from hurry.workflow.interfaces import IWorkflowState
+from zope.component.hooks import setSite, clearSite
+from waeup.kofa.app import University
+from waeup.kofa.students.tests.test_browser import StudentsFullSetup
+from waeup.kofa.testing import FunctionalTestCase
+from waeup.kofa.students.batching import StudentProcessor as StudentProcessorBase
+from waeup.custom.students.batching import StudentProcessor
+from waeup.custom.testing import FunctionalLayer
+from waeup.custom.configuration import SessionConfiguration
+
+STUDENT_SAMPLE_DATA = open(
+    os.path.join(os.path.dirname(__file__), 'sample_student_data.csv'),
+    'rb').read()
+
+STUDENT_HEADER_FIELDS = STUDENT_SAMPLE_DATA.split(
+    '\n')[0].split(',')
+
+class StudentImporterTest(FunctionalTestCase):
+    """Perform some batching tests.
+    """
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(StudentImporterTest, self).setUp()
+        # Setup a sample site for each test
+        app = University()
+        self.dc_root = tempfile.mkdtemp()
+        app['datacenter'].setStoragePath(self.dc_root)
+
+        # Prepopulate the ZODB...
+        self.getRootFolder()['app'] = app
+        # we add the site immediately after creation to the
+        # ZODB. Catalogs and other local utilities are not setup
+        # before that step.
+        self.app = self.getRootFolder()['app']
+        # Set site here. Some of the following setup code might need
+        # to access grok.getSite() and should get our new app then
+        setSite(app)
+
+        self.importer_base = StudentProcessorBase()
+        self.importer = StudentProcessor()
+        self.workdir = tempfile.mkdtemp()
+        self.csv_file = os.path.join(self.workdir, 'sample_student_data.csv')
+        open(self.csv_file, 'wb').write(STUDENT_SAMPLE_DATA)
+
+    def tearDown(self):
+        super(StudentImporterTest, self).tearDown()
+        shutil.rmtree(self.workdir)
+        shutil.rmtree(self.dc_root)
+        clearSite()
+        return
+
+    def test_import(self):
+        # We added empty columns 'nationality' and 'lga' to the import file.
+        # The original importer will fail because these fields are required
+        # in the base package.
+        num, num_warns, fin_file, fail_file = self.importer_base.doImport(
+            self.csv_file, STUDENT_HEADER_FIELDS)
+        self.assertEqual(num_warns,3)
+        assert len(self.app['students'].keys()) == 0
+        # The customized importer does not complain since both fields are
+        # not required in the custom package.
+        num, num_warns, fin_file, fail_file = self.importer.doImport(
+            self.csv_file, STUDENT_HEADER_FIELDS)
+        self.assertEqual(num_warns,0)
+        assert len(self.app['students'].keys()) == 3
+        shutil.rmtree(os.path.dirname(fin_file))
+
+
+class StudentUITests(StudentsFullSetup):
+    """Tests for customized student class views and pages
+    """
+
+    layer = FunctionalLayer
+
+    def callback_url(self, payment_url, resp, apprAmt):
+        return payment_url + (
+            '/callback?echo=' +
+            '&resp=%s' +
+            '&desc=Something went wrong' +
+            '&txnRef=p1331792385335' +
+            '&payRef=' + '&retRef=' +
+            '&cardNum=0' +
+            '&apprAmt=%s' +
+            '&url=http://xyz') % (resp, apprAmt)
+
+    def test_manage_payments(self):
+        # Add missing configuration data
+        self.app['configuration']['2004'].gown_fee = 150
+        self.app['configuration']['2004'].transfer_fee = 90
+        self.app['configuration']['2004'].clearance_fee = 120
+        self.app['configuration']['2004'].maint_fee = 180
+
+        # Managers can add online payment tickets
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.payments_student_path)
+        self.browser.getControl("Add online payment ticket").click()
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...Amount could not be determined...',
+                           self.browser.contents)
+        IWorkflowState(self.student).setState('cleared')
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...ticket created...',
+                           self.browser.contents)
+        ctrl = self.browser.getControl(name='val_id')
+        value = ctrl.options[0]
+        self.browser.getLink(value).click()
+        self.assertMatches('...Amount Authorized...',
+                           self.browser.contents)
+        # Set ticket paid
+        ticket = self.student['payments'].items()[0][1]
+        ticket.p_state = 'paid'
+        IWorkflowState(self.student).setState('returning')
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...This type of payment has already been made...',
+                           self.browser.contents)
+        # Remove all payments so that we can add a school fee payment again
+        keys = [i for i in self.student['payments'].keys()]
+        for payment in keys:
+            del self.student['payments'][payment]
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...ticket created...',
+                           self.browser.contents)
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['gown']
+        self.browser.getControl("Create ticket").click()
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['transfer']
+        self.browser.getControl("Create ticket").click()
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl(
+            name="form.p_category").value = ['bed_allocation']
+        self.browser.getControl("Create ticket").click()
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl(
+            name="form.p_category").value = ['hostel_maintenance']
+        self.browser.getControl("Create ticket").click()
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['clearance']
+        self.browser.getControl("Create ticket").click()
+        self.certificate.study_mode = 'ug_pt'
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['schoolfee']
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...Amount could not be determined...',
+                           self.browser.contents)
+
+        # If the session configuration doesn't exist and error message will
+        # be shown
+        del self.app['configuration']['2004']
+        self.browser.open(self.payments_student_path)
+        self.browser.getControl("Add online payment ticket").click()
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...Session configuration object is not...',
+                           self.browser.contents)
+
+
