Ignore:
Timestamp:
19 Sep 2012, 13:59:39 (12 years ago)
Author:
Henrik Bettermann
Message:

Previous session must really be a previous session.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
3 edited

Legend:

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

    r9201 r9204  
    12551255        if error is not None:
    12561256            self.flash(error)
    1257             if 'Would you like' in error:
     1257            if 'previous session' in error:
    12581258                self.redirect(self.url(self.context) + '/@@addpp')
    12591259                return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9191 r9204  
    15991599
    16001600    def test_student_previous_payments(self):
     1601        configuration = createObject('waeup.SessionConfiguration')
     1602        configuration.academic_session = 2000
     1603        configuration.clearance_fee = 3456.0
     1604        configuration.booking_fee = 123.4
     1605        self.student['studycourse'].entry_session = 2002
     1606        self.app['configuration'].addSessionConfiguration(configuration)
     1607        configuration2 = createObject('waeup.SessionConfiguration')
     1608        configuration2.academic_session = 2003
     1609        configuration2.clearance_fee = 3456.0
     1610        configuration2.booking_fee = 123.4
     1611        self.student['studycourse'].entry_session = 2002
     1612        self.app['configuration'].addSessionConfiguration(configuration2)
    16011613        # Login
    16021614        self.browser.open(self.login_path)
     
    16211633        # Previous session payment form is provided
    16221634        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     1635        self.browser.getControl(name="form.p_session").value = ['2000']
     1636        self.browser.getControl(name="form.p_level").value = ['300']
     1637        self.browser.getControl("Create ticket").click()
     1638        self.assertMatches('...The previous session must not fall below...',
     1639                           self.browser.contents)
     1640        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    16231641        self.browser.getControl(name="form.p_session").value = ['2004']
     1642        self.browser.getControl(name="form.p_level").value = ['300']
     1643        self.browser.getControl("Create ticket").click()
     1644        self.assertMatches('...This is not a previous session...',
     1645                           self.browser.contents)
     1646        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     1647        self.browser.getControl(name="form.p_session").value = ['2003']
    16241648        self.browser.getControl(name="form.p_level").value = ['300']
    16251649        self.browser.getControl("Create ticket").click()
     
    16341658
    16351659        # Payment session is properly set
    1636         self.assertEqual(self.student['payments'][value].p_session, 2004)
     1660        self.assertEqual(self.student['payments'][value].p_session, 2003)
    16371661        self.assertEqual(self.student['payments'][value].p_level, 300)
    16381662
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r9191 r9204  
    328328                return _('Study course data are incomplete.'), None
    329329            if previous_session:
     330                if previous_session < student['studycourse'].entry_session:
     331                    return _('The previous session must not fall below '
     332                             'your entry session.'), None
     333                if previous_session > student['studycourse'].current_session - 1:
     334                    return _('This is not a previous session.'), None
    330335                if previous_level == 100:
    331336                    amount = getattr(certificate, 'school_fee_1', 0.0)
Note: See TracChangeset for help on using the changeset viewer.