Index: main/waeup.uniben/trunk/src/waeup/uniben/etranzact/browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/etranzact/browser.py	(revision 8266)
+++ main/waeup.uniben/trunk/src/waeup/uniben/etranzact/browser.py	(revision 8267)
@@ -30,8 +30,8 @@
 from waeup.uniben.applicants.interfaces import ICustomApplicantOnlinePayment
 
-
-TERMINAL_ID = '0500000003'
-QUERY_URL =   'https://www.etranzact.net/Query/queryPayoutletTransaction.jsp'
-
+#TERMINAL_ID = '0500000003'
+TERMINAL_ID = '0000000001'
+#QUERY_URL =   'https://www.etranzact.net/Query/queryPayoutletTransaction.jsp'
+QUERY_URL =   'http://demo.etranzact.com:8080/WebConnect/queryPayoutletTransaction.jsp'
 
 def query_etranzact(confirmation_number, user, payment, view):
Index: main/waeup.uniben/trunk/src/waeup/uniben/etranzact/tests.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/etranzact/tests.py	(revision 8266)
+++ main/waeup.uniben/trunk/src/waeup/uniben/etranzact/tests.py	(revision 8267)
@@ -18,4 +18,6 @@
 from hurry.workflow.interfaces import IWorkflowState
 from waeup.kofa.students.tests.test_browser import StudentsFullSetup
+from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
+from waeup.kofa.configuration import SessionConfiguration
 from waeup.uniben.testing import FunctionalLayer
 
@@ -24,5 +26,5 @@
 #   If you enable this, please make sure the external services
 #   do exist really and are not bothered by being spammed by a test programme.
-EXTERNAL_TESTS = False
+EXTERNAL_TESTS = True
 
 def external_test(func):
@@ -36,5 +38,5 @@
     return func
 
-class EtranzactTests(StudentsFullSetup):
+class EtranzactTestsStudent(StudentsFullSetup):
     """Tests for the eTranzact payment gateway.
     """
@@ -45,5 +47,5 @@
 
     def setUp(self):
-        super(EtranzactTests, self).setUp()
+        super(EtranzactTestsStudent, self).setUp()
         # Managers can add online payment tickets
         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
@@ -72,11 +74,65 @@
         self.browser.open(self.payment_url + '/query_history?confirmation_number=%s'
             % self.CONFIRMATION_NO)
-        self.assertMatches('...Wrong amount...',
+        self.assertMatches('...Invalid or unsuccessful callback:...',
                           self.browser.contents)
+        #self.assertMatches('...Wrong amount...',
+        #                  self.browser.contents)
+        #self.student['payments'][value].amount_auth = self.student[
+        #    'payments'][value].r_amount_approved
+        #self.browser.open(self.payment_url + '/query_history?confirmation_number=%s'
+        #    % self.CONFIRMATION_NO)
+        #self.assertMatches('...Wrong transaction id...',
+        #                  self.browser.contents)
 
-        self.student['payments'][value].amount_auth = self.student[
-            'payments'][value].r_amount_approved
+class EtranzactTestsApplicants(ApplicantsFullSetup):
+    """Tests for the Interswitch payment gateway.
+    """
+
+    layer = FunctionalLayer
+
+    CONFIRMATION_NO = '500856521315472785095'
+
+    def setUp(self):
+        super(EtranzactTestsApplicants, self).setUp()
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.manage_path)
+        #IWorkflowState(self.student).setState('started')
+        super(EtranzactTestsApplicants, self).fill_correct_values()
+        self.browser.getControl(name="transition").value = ['start']
+        self.browser.getControl("Save").click()
+        self.browser.getControl("Add online").click()
+        self.assertTrue(
+            'Session configuration object is not available'
+            in self.browser.contents)
+        configuration = SessionConfiguration()
+        configuration.academic_session = 2009
+        configuration.application_fee = 1000.0
+        self.app['configuration'].addSessionConfiguration(configuration)
+        self.browser.getControl("Add online").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)
+        self.assertMatches(
+            '...<span>1000.0</span>...',
+            self.browser.contents)
+        self.payment_url = self.browser.url
+
+    @external_test
+    def test_etranzact_query_history(self):
+
         self.browser.open(self.payment_url + '/query_history?confirmation_number=%s'
             % self.CONFIRMATION_NO)
-        self.assertMatches('...Wrong transaction id...',
+        self.assertMatches('...Invalid or unsuccessful callback:...',
                           self.browser.contents)
+        #self.assertMatches('...Wrong amount...',
+        #                  self.browser.contents)
+        #self.applicant[value].amount_auth = self.applicant[
+        #    value].r_amount_approved
+        #self.browser.open(self.payment_url + '/query_history?confirmation_number=%s'
+        #    % self.CONFIRMATION_NO)
+        #self.assertMatches('...Wrong transaction id...',
+        #                  self.browser.contents)
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 8266)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 8267)
@@ -113,4 +113,8 @@
         self.assertMatches('...First Sitting Record...',
                            self.browser.contents)
+        # Managers can open clearance slip of ug students
+        self.browser.open(self.student_path + '/clearance.pdf')
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
         # There is no pg field in the clearance form
         self.assertFalse('Second Higher Education Record'
@@ -125,4 +129,8 @@
         self.assertMatches('...First Sitting Record...',
                            self.browser.contents)
+        # Managers can open clearance slip of pg students
+        self.browser.open(self.student_path + '/clearance.pdf')
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
 
     def test_manage_payments(self):
@@ -150,4 +158,8 @@
         self.assertMatches('...Amount Authorized...',
                            self.browser.contents)
+        # Managers can open payment slip
+        self.browser.getLink("Download payment slip").click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
         # Set ticket paid
         ticket = self.student['payments'].items()[0][1]
@@ -198,2 +210,17 @@
         self.assertMatches('...Session configuration object is not...',
                            self.browser.contents)
+
+    def test_student_access(self):
+        # Students can edit clearance data
+        IWorkflowState(self.student).setState('cleared')
+        self.student.clearance_locked = False
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        # Student can view and edit clearance data
+        self.browser.getLink("Clearance Data").click()
+        self.browser.getLink("Edit").click()
+        self.assertTrue('Save' in self.browser.contents)
+
+
