Ignore:
Timestamp:
3 Nov 2012, 18:47:31 (12 years ago)
Author:
Henrik Bettermann
Message:

Clearly separate current and previous session payment browser components.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9516 r9517  
    760760        self.browser.open(self.payments_path)
    761761        IWorkflowState(self.student).setState('cleared')
    762         self.browser.getControl("Add online payment ticket").click()
     762        self.browser.getLink("Add current session payment ticket").click()
    763763        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    764764        self.browser.getControl("Create ticket").click()
     
    781781        # can be initialized a second time if the former ticket is not yet paid.
    782782        self.browser.open(self.payments_path)
    783         self.browser.getControl("Add online payment ticket").click()
     783        self.browser.getLink("Add current session payment ticket").click()
    784784        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    785785        self.browser.getControl("Create ticket").click()
     
    827827        # (with same p_item, p_session and p_category) can be added
    828828        self.browser.open(self.payments_path)
    829         self.browser.getControl("Add online payment ticket").click()
     829        self.browser.getLink("Add current session payment ticket").click()
    830830        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    831831        self.browser.getControl("Create ticket").click()
     
    833833            '...This type of payment has already been made...',
    834834            self.browser.contents)
    835         # The PreviousPaymentAddFormPage opens
    836         self.assertEqual(self.browser.url, self.payments_path + '/@@addpp')
    837835
    838836        # Managers can open the pdf payment slip
     
    887885        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    888886        self.browser.open(self.payments_path)
    889         self.browser.getControl("Add online payment ticket").click()
     887        self.browser.getLink("Add current session payment ticket").click()
    890888        self.browser.getControl(name="form.p_category").value = ['bed_allocation']
    891889        # If student is not in accommodation session, payment cannot be processed
     
    895893                           self.browser.contents)
    896894        self.app['hostels'].accommodation_session = 2004
    897         self.browser.getControl("Add online payment ticket").click()
     895        self.browser.getLink("Add current session payment ticket").click()
    898896        self.browser.getControl(name="form.p_category").value = ['bed_allocation']
    899897        self.browser.getControl("Create ticket").click()
     
    20462044        self.assertRaises(
    20472045            LookupError, self.browser.getControl, name='val_id')
    2048         self.browser.getControl("Add online payment ticket").click()
     2046        self.browser.getLink("Add current session payment ticket").click()
    20492047        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    20502048        self.browser.getControl("Create ticket").click()
     
    21362134        configuration2.booking_fee = 123.4
    21372135        self.app['configuration'].addSessionConfiguration(configuration2)
    2138 
     2136        configuration3 = createObject('waeup.SessionConfiguration')
     2137        configuration3.academic_session = 2005
     2138        configuration3.clearance_fee = 3456.0
     2139        configuration3.booking_fee = 123.4
     2140        self.app['configuration'].addSessionConfiguration(configuration3)
    21392141        self.student['studycourse'].entry_session = 2002
    21402142
     
    21482150        IWorkflowState(self.student).setState('courses registered')
    21492151        self.browser.open(self.payments_path)
    2150         self.browser.getControl("Add online payment ticket").click()
    2151         self.browser.getControl(name="form.p_category").value = ['schoolfee']
    2152         self.browser.getControl("Create ticket").click()
    2153 
    2154         # Amount cannot be determined since the state is not
    2155         # 'cleared' or 'returning'
    2156         self.assertMatches('...Amount could not be determined...',
    2157                            self.browser.contents)
    2158         self.assertMatches('...Would you like to pay for a previous session?...',
    2159                            self.browser.contents)
     2152        self.browser.getLink("Add previous session payment ticket").click()
    21602153
    21612154        # Previous session payment form is provided
     2155        self.assertEqual(self.student.current_session, 2004)
    21622156        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    21632157        self.browser.getControl(name="form.p_session").value = ['2000']
     
    21672161                           self.browser.contents)
    21682162        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    2169         self.browser.getControl(name="form.p_session").value = ['2004']
     2163        self.browser.getControl(name="form.p_session").value = ['2005']
    21702164        self.browser.getControl(name="form.p_level").value = ['300']
    21712165        self.browser.getControl("Create ticket").click()
    21722166        self.assertMatches('...This is not a previous session...',
    21732167                           self.browser.contents)
     2168        # Students can pay current session school fee.
    21742169        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    2175         self.browser.getControl(name="form.p_session").value = ['2003']
     2170        self.browser.getControl(name="form.p_session").value = ['2004']
    21762171        self.browser.getControl(name="form.p_level").value = ['300']
    21772172        self.browser.getControl("Create ticket").click()
     
    21862181
    21872182        # Payment session is properly set
    2188         self.assertEqual(self.student['payments'][value].p_session, 2003)
     2183        self.assertEqual(self.student['payments'][value].p_session, 2004)
    21892184        self.assertEqual(self.student['payments'][value].p_level, 300)
    21902185
     
    22002195        # Current payment flag is set False
    22012196        self.assertFalse(self.student['payments'][value].p_current)
     2197
     2198        # Button and form are not available for fresh students
     2199        self.student['studycourse'].entry_session = 2004
     2200        self.browser.open(self.payments_path)
     2201        self.assertFalse(
     2202            "Add previous session payment ticket" in self.browser.contents)
     2203        self.browser.open(self.payments_path + '/addpp')
     2204        self.assertTrue(
     2205            "You can't pay for a session below your entry session" in
     2206            self.browser.contents)
    22022207        return
    22032208
     
    22152220        IWorkflowState(self.student).setState('cleared')
    22162221        self.browser.open(self.payments_path)
    2217         self.browser.getControl("Add online payment ticket").click()
     2222        self.browser.getLink("Add current session payment ticket").click()
    22182223        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    22192224        self.browser.getControl("Create ticket").click()
     
    22552260        # Remove first payment to be sure that we access the right ticket
    22562261        del self.student['payments'][value]
    2257         self.browser.getControl("Add online payment ticket").click()
     2262        self.browser.getLink("Add current session payment ticket").click()
    22582263        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    22592264        self.browser.getControl("Create ticket").click()
     
    23012306        # callback view (see test_manage_payments)
    23022307        self.browser.getLink("Payments").click()
    2303         self.browser.getControl("Add online payment ticket").click()
     2308        self.browser.getLink("Add current session payment ticket").click()
    23042309        self.browser.getControl(name="form.p_category").value = ['bed_allocation']
    23052310        self.browser.getControl("Create ticket").click()
Note: See TracChangeset for help on using the changeset viewer.