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.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students/tests
Files:
2 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
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r9028 r9148  
    371371        self.assertEqual(
    372372            result,
    373             'ac,amount_auth,creation_date,p_category,p_id,'
     373            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
    374374            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    375375            'r_code,r_desc,student_id\r\n'
    376376
    377             ',0.0,2012-04-01 13:12:01,schoolfee,,,,,unpaid,,0.0,,,\r\n'
     377            ',0.0,2012-04-01 13:12:01,schoolfee,1,,,,,unpaid,,0.0,,,\r\n'
    378378            )
    379379        return
     
    389389        self.assertEqual(
    390390            result,
    391             'ac,amount_auth,creation_date,p_category,p_id,'
     391            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
    392392            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    393393            'r_code,r_desc,student_id\r\n'
    394394
    395             '666,0.0,2012-04-01 13:12:01,schoolfee,my-id,'
     395            '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,'
    396396            'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
    397397            'r-code,,A111111\r\n'
     
    408408        self.assertEqual(
    409409            result,
    410             'ac,amount_auth,creation_date,p_category,p_id,'
     410            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
    411411            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    412412            'r_code,r_desc,student_id\r\n'
    413413
    414             '666,0.0,2012-04-01 13:12:01,schoolfee,my-id,'
     414            '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,'
    415415            'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
    416416            'r-code,,A111111\r\n'
     
    427427        self.assertEqual(
    428428            result,
    429             'ac,amount_auth,creation_date,p_category,p_id,'
     429            'ac,amount_auth,creation_date,p_category,p_current,p_id,'
    430430            'p_item,p_level,p_session,p_state,payment_date,r_amount_approved,'
    431431            'r_code,r_desc,student_id\r\n'
    432432
    433             '666,0.0,2012-04-01 13:12:01,schoolfee,my-id,'
     433            '666,0.0,2012-04-01 13:12:01,schoolfee,1,my-id,'
    434434            'p-item,100,2012,unpaid,2012-04-01 14:12:01,12.12,'
    435435            'r-code,,A111111\r\n'
Note: See TracChangeset for help on using the changeset viewer.