Ignore:
Timestamp:
3 Sep 2012, 14:47:24 (12 years ago)
Author:
Henrik Bettermann
Message:

Enable previous session payments. Do not create activation code after successful previous session payment. Show previous session payment form only if current session ticket creation failed.

Attention: setPaymentDetails method has changed. Two additional parameters expected.

File:
1 edited

Legend:

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

    r9139 r9148  
    15751575        return
    15761576
    1577     def test_postgraduate_payments(self):
     1577    def test_student_previous_payments(self):
     1578        # Login
     1579        self.browser.open(self.login_path)
     1580        self.browser.getControl(name="form.login").value = self.student_id
     1581        self.browser.getControl(name="form.password").value = 'spwd'
     1582        self.browser.getControl("Login").click()
     1583
     1584        # Students can add previous school fee payment tickets in any state.
     1585        IWorkflowState(self.student).setState('courses registered')
     1586        self.browser.open(self.payments_path)
     1587        self.browser.getControl("Add online payment ticket").click()
     1588        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     1589        self.browser.getControl("Create ticket").click()
     1590
     1591        # Amount cannot be determined since the state is not
     1592        # 'cleared' or 'returning'
     1593        self.assertMatches('...Amount could not be determined...',
     1594                           self.browser.contents)
     1595        self.assertMatches('...Would you like to pay for a previous session?...',
     1596                           self.browser.contents)
     1597
     1598        # Previous session payment form is provided
     1599        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     1600        self.browser.getControl(name="form.p_session").value = ['2004']
     1601        self.browser.getControl(name="form.p_level").value = ['300']
     1602        self.browser.getControl("Create ticket").click()
     1603        self.assertMatches('...ticket created...',
     1604                           self.browser.contents)
     1605        ctrl = self.browser.getControl(name='val_id')
     1606        value = ctrl.options[0]
     1607        self.browser.getLink(value).click()
     1608        self.assertMatches('...Amount Authorized...',
     1609                           self.browser.contents)
     1610        self.assertEqual(self.student['payments'][value].amount_auth, 20000.0)
     1611
     1612        # Payment session is properly set
     1613        self.assertEqual(self.student['payments'][value].p_session, 2004)
     1614        self.assertEqual(self.student['payments'][value].p_level, 300)
     1615
     1616        # We simulate the approval
     1617        self.browser.open(self.browser.url + '/fake_approve')
     1618        self.assertMatches('...Payment approved...',
     1619                          self.browser.contents)
     1620
     1621        # No AC has been created
     1622        self.assertEqual(len(self.app['accesscodes']['SFE-0'].keys()), 0)
     1623        self.assertTrue(self.student['payments'][value].ac is None)
     1624
     1625        # Current payment flag is set False
     1626        self.assertFalse(self.student['payments'][value].p_current)
     1627        return
     1628
     1629    def test_student_postgraduate_payments(self):
    15781630        self.certificate.study_mode = 'pg_ft'
    15791631        self.certificate.start_level = 999
Note: See TracChangeset for help on using the changeset viewer.