Changeset 8267


Ignore:
Timestamp:
24 Apr 2012, 21:30:43 (12 years ago)
Author:
Henrik Bettermann
Message:

Optimize gataway tests. We can't test more.

Location:
main/waeup.uniben/trunk/src/waeup/uniben
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/etranzact/browser.py

    r8259 r8267  
    3030from waeup.uniben.applicants.interfaces import ICustomApplicantOnlinePayment
    3131
    32 
    33 TERMINAL_ID = '0500000003'
    34 QUERY_URL =   'https://www.etranzact.net/Query/queryPayoutletTransaction.jsp'
    35 
     32#TERMINAL_ID = '0500000003'
     33TERMINAL_ID = '0000000001'
     34#QUERY_URL =   'https://www.etranzact.net/Query/queryPayoutletTransaction.jsp'
     35QUERY_URL =   'http://demo.etranzact.com:8080/WebConnect/queryPayoutletTransaction.jsp'
    3636
    3737def query_etranzact(confirmation_number, user, payment, view):
  • main/waeup.uniben/trunk/src/waeup/uniben/etranzact/tests.py

    r8020 r8267  
    1818from hurry.workflow.interfaces import IWorkflowState
    1919from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     20from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
     21from waeup.kofa.configuration import SessionConfiguration
    2022from waeup.uniben.testing import FunctionalLayer
    2123
     
    2426#   If you enable this, please make sure the external services
    2527#   do exist really and are not bothered by being spammed by a test programme.
    26 EXTERNAL_TESTS = False
     28EXTERNAL_TESTS = True
    2729
    2830def external_test(func):
     
    3638    return func
    3739
    38 class EtranzactTests(StudentsFullSetup):
     40class EtranzactTestsStudent(StudentsFullSetup):
    3941    """Tests for the eTranzact payment gateway.
    4042    """
     
    4547
    4648    def setUp(self):
    47         super(EtranzactTests, self).setUp()
     49        super(EtranzactTestsStudent, self).setUp()
    4850        # Managers can add online payment tickets
    4951        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    7274        self.browser.open(self.payment_url + '/query_history?confirmation_number=%s'
    7375            % self.CONFIRMATION_NO)
    74         self.assertMatches('...Wrong amount...',
     76        self.assertMatches('...Invalid or unsuccessful callback:...',
    7577                          self.browser.contents)
     78        #self.assertMatches('...Wrong amount...',
     79        #                  self.browser.contents)
     80        #self.student['payments'][value].amount_auth = self.student[
     81        #    'payments'][value].r_amount_approved
     82        #self.browser.open(self.payment_url + '/query_history?confirmation_number=%s'
     83        #    % self.CONFIRMATION_NO)
     84        #self.assertMatches('...Wrong transaction id...',
     85        #                  self.browser.contents)
    7686
    77         self.student['payments'][value].amount_auth = self.student[
    78             'payments'][value].r_amount_approved
     87class EtranzactTestsApplicants(ApplicantsFullSetup):
     88    """Tests for the Interswitch payment gateway.
     89    """
     90
     91    layer = FunctionalLayer
     92
     93    CONFIRMATION_NO = '500856521315472785095'
     94
     95    def setUp(self):
     96        super(EtranzactTestsApplicants, self).setUp()
     97        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     98        self.browser.open(self.manage_path)
     99        #IWorkflowState(self.student).setState('started')
     100        super(EtranzactTestsApplicants, self).fill_correct_values()
     101        self.browser.getControl(name="transition").value = ['start']
     102        self.browser.getControl("Save").click()
     103        self.browser.getControl("Add online").click()
     104        self.assertTrue(
     105            'Session configuration object is not available'
     106            in self.browser.contents)
     107        configuration = SessionConfiguration()
     108        configuration.academic_session = 2009
     109        configuration.application_fee = 1000.0
     110        self.app['configuration'].addSessionConfiguration(configuration)
     111        self.browser.getControl("Add online").click()
     112        self.assertMatches('...ticket created...',
     113                           self.browser.contents)
     114        ctrl = self.browser.getControl(name='val_id')
     115        value = ctrl.options[0]
     116        self.browser.getLink(value).click()
     117        self.assertMatches('...Amount Authorized...',
     118                           self.browser.contents)
     119        self.assertMatches(
     120            '...<span>1000.0</span>...',
     121            self.browser.contents)
     122        self.payment_url = self.browser.url
     123
     124    @external_test
     125    def test_etranzact_query_history(self):
     126
    79127        self.browser.open(self.payment_url + '/query_history?confirmation_number=%s'
    80128            % self.CONFIRMATION_NO)
    81         self.assertMatches('...Wrong transaction id...',
     129        self.assertMatches('...Invalid or unsuccessful callback:...',
    82130                          self.browser.contents)
     131        #self.assertMatches('...Wrong amount...',
     132        #                  self.browser.contents)
     133        #self.applicant[value].amount_auth = self.applicant[
     134        #    value].r_amount_approved
     135        #self.browser.open(self.payment_url + '/query_history?confirmation_number=%s'
     136        #    % self.CONFIRMATION_NO)
     137        #self.assertMatches('...Wrong transaction id...',
     138        #                  self.browser.contents)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r8265 r8267  
    113113        self.assertMatches('...First Sitting Record...',
    114114                           self.browser.contents)
     115        # Managers can open clearance slip of ug students
     116        self.browser.open(self.student_path + '/clearance.pdf')
     117        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     118        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    115119        # There is no pg field in the clearance form
    116120        self.assertFalse('Second Higher Education Record'
     
    125129        self.assertMatches('...First Sitting Record...',
    126130                           self.browser.contents)
     131        # Managers can open clearance slip of pg students
     132        self.browser.open(self.student_path + '/clearance.pdf')
     133        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     134        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    127135
    128136    def test_manage_payments(self):
     
    150158        self.assertMatches('...Amount Authorized...',
    151159                           self.browser.contents)
     160        # Managers can open payment slip
     161        self.browser.getLink("Download payment slip").click()
     162        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     163        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    152164        # Set ticket paid
    153165        ticket = self.student['payments'].items()[0][1]
     
    198210        self.assertMatches('...Session configuration object is not...',
    199211                           self.browser.contents)
     212
     213    def test_student_access(self):
     214        # Students can edit clearance data
     215        IWorkflowState(self.student).setState('cleared')
     216        self.student.clearance_locked = False
     217        self.browser.open(self.login_path)
     218        self.browser.getControl(name="form.login").value = self.student_id
     219        self.browser.getControl(name="form.password").value = 'spwd'
     220        self.browser.getControl("Login").click()
     221        # Student can view and edit clearance data
     222        self.browser.getLink("Clearance Data").click()
     223        self.browser.getLink("Edit").click()
     224        self.assertTrue('Save' in self.browser.contents)
     225
     226
Note: See TracChangeset for help on using the changeset viewer.