Index: /main/waeup.custom/trunk/src/waeup/custom/etranzact/tests.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/etranzact/tests.py	(revision 7969)
+++ /main/waeup.custom/trunk/src/waeup/custom/etranzact/tests.py	(revision 7970)
@@ -20,4 +20,20 @@
 from waeup.custom.testing import FunctionalLayer
 
+
+# Also run tests that send requests to external servers?
+#   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
+
+def external_test(func):
+    if not EXTERNAL_TESTS:
+        myself = __file__
+        if myself.endswith('.pyc'):
+            myself = myself[:-2]
+        print "WARNING: external tests are skipped!"
+        print "WARNING: edit %s to enable them." % myself
+        return
+    return func
+
 class EtranzactTests(StudentsFullSetup):
     """Tests foreTranzact payment gateway.
@@ -28,4 +44,8 @@
     CONFIRMATION_NO = '500856521315472785095'
 
+    def test_dummy(self):
+        return
+
+    @external_test
     def test_etranzact_query_history(self):
 
Index: /main/waeup.custom/trunk/src/waeup/custom/interswitch/browser.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/interswitch/browser.py	(revision 7969)
+++ /main/waeup.custom/trunk/src/waeup/custom/interswitch/browser.py	(revision 7970)
@@ -191,5 +191,4 @@
         student = self.context.getStudent()
         query = self.request.form
-        # Should be logged instead of printed
         write_log_message(self,'callback received: %s' % query)
 
@@ -214,25 +213,26 @@
         if self.context.r_amount_approved != total_amount_auth:
             self.flash(_('Wrong amount'))
-            write_log_message(self,'successful but wrong amount: %s' % self.context.p_id)
-            self.context.p_state = 'failed'
-            return
-
-        # Add webservice validation
+            write_log_message(
+                self,'successful but wrong amount: %s' % self.context.p_id)
+            self.context.p_state = 'failed'
+            return
+
         try:
             validation_list = get_SOAP_response(
                 PRODUCT_ID, self.context.p_id).split(':')
             # Validation does not make sense yet since the query string
-            # formats are conflicting. We are only printing the validation string,
-            # nothing else.
-            print validation_list
+            # formats are conflicting. We are only printing the validation
+            # string, nothing else.
+            print 'WARNING: Webservice validation is not yet implemented'
+            print 'validation list: %s' % validation_list
         except:
             print 'Connection to webservice failed.'
+
+        # Add webservice validation here
 
         write_log_message(self,'valid callback: %s' % self.context.p_id)
         self.context.p_state = 'paid'
         self.context.payment_date = datetime.now()
-
         actions_after_payment(student, self.context, self)
-
         return
 
@@ -271,5 +271,6 @@
             self.flash(_('Unsuccessful callback: ${a}',
                 mapping = {'a': wlist[1]}))
-            write_log_message(self,'unsuccessful callback: %s' % self.context.p_id)
+            write_log_message(
+                self,'unsuccessful callback: %s' % self.context.p_id)
             self.context.p_state = 'failed'
             return
@@ -282,5 +283,7 @@
         if self.context.r_amount_approved != total_amount_auth:
             self.flash(_('Wrong amount'))
-            write_log_message(self,'successful callback but wrong amount: %s' % self.context.p_id)
+            write_log_message(
+                self,'successful callback but wrong amount: %s'
+                % self.context.p_id)
             self.context.p_state = 'failed'
             return
@@ -288,5 +291,7 @@
         if wlist[4] != self.context.p_id:
             self.flash(_('Wrong transaction id'))
-            write_log_message(self,'successful callback but wrong transaction id: %s' % self.context.p_id)
+            write_log_message(
+                self,'successful callback but wrong transaction id: %s'
+                % self.context.p_id)
             self.context.p_state = 'failed'
             return
Index: /main/waeup.custom/trunk/src/waeup/custom/interswitch/tests.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/interswitch/tests.py	(revision 7969)
+++ /main/waeup.custom/trunk/src/waeup/custom/interswitch/tests.py	(revision 7970)
@@ -20,4 +20,20 @@
 from waeup.custom.testing import FunctionalLayer
 
+# Also run tests that send requests to external servers?
+#   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
+
+def external_test(func):
+    if not EXTERNAL_TESTS:
+        myself = __file__
+        if myself.endswith('.pyc'):
+            myself = myself[:-2]
+        print "WARNING: external tests are skipped!"
+        print "WARNING: edit %s to enable them." % myself
+        return
+    return func
+
+
 class InterswitchTests(StudentsFullSetup):
     """Tests for the Interswitch payment gateway.
@@ -25,4 +41,21 @@
 
     layer = FunctionalLayer
+
+    def setUp(self):
+        super(InterswitchTests, self).setUp()
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.payments_student_path)
+        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)
+        self.payment_url = self.browser.url
+
 
     def callback_url(self, payment_url, resp, apprAmt):
@@ -37,20 +70,6 @@
             '&url=http://xyz') % (resp, apprAmt)
 
-    def test_callback(self):
+    def test_interswitch_form(self):
 
-        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
-        self.browser.open(self.payments_student_path)
-        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)
-        payment_url = self.browser.url
-        
         # Manager can access InterswitchForm
         self.browser.getLink("CollegePAY", index=0).click()
@@ -61,39 +80,29 @@
             self.browser.contents)
 
+    @external_test
+    def test_callback(self):
+
         # Manager can call callback manually
-        self.browser.open(self.callback_url(payment_url, 'XX', '300'))
+        self.browser.open(self.callback_url(self.payment_url, 'XX', '300'))
         self.assertMatches('...Unsuccessful callback: Something went wrong...',
                           self.browser.contents)
         self.assertMatches('...Failed...',
                            self.browser.contents)
-        self.browser.open(payment_url + '/callback')
+        self.browser.open(self.payment_url + '/callback')
         self.assertMatches('...Unsuccessful callback: Incomplete query string...',
                           self.browser.contents)
         self.assertMatches('...Failed...',
                            self.browser.contents)
-        self.browser.open(self.callback_url(payment_url, '00', '300000'))
+        self.browser.open(self.callback_url(self.payment_url, '00', '300000'))
         self.assertMatches('...Wrong amount...',
                           self.browser.contents)
-        self.browser.open(self.callback_url(payment_url, '00', '4000000'))
+        self.browser.open(self.callback_url(self.payment_url, '00', '4000000'))
         self.assertMatches('...Valid callback received...',
                           self.browser.contents)
 
+    @external_test
     def test_webservice(self):
 
-        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
-        self.browser.open(self.payments_student_path)
-        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)
-        payment_url = self.browser.url
-
-        self.browser.open(payment_url + '/request_webservice')
+        self.browser.open(self.payment_url + '/request_webservice')
         self.assertMatches('...Unsuccessful callback...',
                           self.browser.contents)
