Index: main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 13489)
+++ main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 13512)
@@ -178,20 +178,30 @@
         self.assertMatches('...ticket created...',
                            self.browser.contents)
-
-    def deactivated_test_for_instalment_payments(self):
+        return
+
+    def test_for_instalment_payments(self):
+        self.student['studycourse'].certificate.school_fee_1 = 6666.0
+        self.app['configuration']['2004'].union_fee = 1250.0
+        self.app['configuration']['2004'].welfare_fee = 750.0
+        self.student.nationality = u'NG'
         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
-        self.browser.open(self.payments_path)
         self.browser.open(self.payments_path + '/addop')
         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
         self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
+        self.assertTrue(
+            'Wrong state. Only students in state \'cleared\' are allowed to pay by instalments'
+            in self.browser.contents)
+        IWorkflowState(self.student).setState('cleared')
+        self.browser.open(self.payments_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
+        self.browser.getControl("Create ticket").click()
+        self.assertTrue('ticket created' in self.browser.contents)
         # We can't add the 2nd instalment ticket because the
         # first one has not yet been approved.
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...1st school fee instalment has not yet been paid...',
-                           self.browser.contents)
+        #self.browser.open(self.payments_path + '/addop')
+        #self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
+        #self.browser.getControl("Create ticket").click()
+        #self.assertMatches('...1st school fee instalment has not yet been paid...',
+        #                   self.browser.contents)
         # Ok, then we approve the first instalment ...
         self.browser.open(self.payments_path)
@@ -203,36 +213,16 @@
         self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
         self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
+        self.assertTrue('ticket created' in self.browser.contents)
         # ... approve the second instalment ...
         ctrl = self.browser.getControl(name='val_id')
         p_id = ctrl.options[1]
         self.browser.open(self.payments_path + '/' + p_id + '/approve')
-        # ... and finally add the 1st instalment for the next session
-        # provided that student is returning.
-        IWorkflowState(self.student).setState('returning')
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Session configuration object is not...',
-                           self.browser.contents)
-        # Uups, we forgot to add a session configuration for next session
-        configuration = createObject('waeup.SessionConfiguration')
-        configuration.academic_session = 2005
-        self.app['configuration'].addSessionConfiguration(configuration)
-        self.app['configuration']['2005'].school_base = 7777.0
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        # If the session configuration doesn't exist an error message will
-        # be shown. No other requirement is being checked.
-        del self.app['configuration']['2004']
-        self.browser.open(self.payments_path)
-        self.browser.getLink("Add current session payment ticket").click()
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Session configuration object is not...',
-                           self.browser.contents)
+        self.assertEqual(self.student['payments'].values()[0].p_category, 'schoolfee_1')
+        self.assertEqual(self.student['payments'].values()[1].p_category, 'schoolfee_2')
+        # 6666/2 + 1250 + 750 - 500
+        self.assertEqual(self.student['payments'].values()[0].amount_auth, 4833.0)
+        # 6666/2
+        self.assertEqual(self.student['payments'].values()[1].amount_auth, 3333.0)
+        return
 
     def test_manage_payments_bypass_ac_creation(self):
