Changeset 9206


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

Previous session must be valid.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
2 edited

Legend:

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

    r9157 r9206  
    219219        self.app['configuration']['2004'].booking_fee = 150.0
    220220        self.app['configuration']['2004'].maint_fee = 180.0
     221
     222        configuration = createObject('waeup.SessionConfiguration')
     223        configuration.academic_session = 2000
     224        self.app['configuration'].addSessionConfiguration(configuration)
     225        configuration2 = createObject('waeup.SessionConfiguration')
     226        configuration2.academic_session = 2002
     227        self.app['configuration'].addSessionConfiguration(configuration2)
     228        configuration3 = createObject('waeup.SessionConfiguration')
     229        configuration3.academic_session = 2003
     230        self.app['configuration'].addSessionConfiguration(configuration3)
     231
    221232        utils = getUtility(IStudentsUtils)
    222233
     234        self.student['studycourse'].entry_session = 2002
    223235        self.student.nationality = u'NG'
    224236
     
    232244        self.assertTrue(u'Amount could not be determined.' in error)
    233245
     246        # Previous session must be valid.
     247        error, payment = utils.setPaymentDetails('schoolfee',
     248            self.student, 2000, 300)
     249        self.assertEqual(payment, None)
     250        self.assertTrue(u'The previous session must not fall below' in error)
     251        error, payment = utils.setPaymentDetails('schoolfee',
     252            self.student, 2004, 300)
     253        self.assertEqual(payment, None)
     254        self.assertTrue(u'This is not a previous session' in error)
     255
    234256        # Previous session payment; fresh and returning
    235257        # are distinguished by their entry_level
    236258        error, payment = utils.setPaymentDetails('schoolfee',
    237             self.student, 2004, 300)
     259            self.student, 2002, 300)
    238260        self.assertEqual(payment.amount_auth, 40000.0)
    239         self.assertEqual(payment.p_session, 2004)
     261        self.assertEqual(payment.p_session, 2002)
    240262        self.assertEqual(payment.p_level, 300)
    241263        self.assertFalse(payment.p_current)
    242264        error, payment = utils.setPaymentDetails('schoolfee',
    243             self.student, 2005, 300)
     265            self.student, 2003, 300)
    244266        self.assertEqual(payment.amount_auth, 20000.0)
    245         self.assertEqual(payment.p_session, 2005)
     267        self.assertEqual(payment.p_session, 2003)
    246268        self.assertEqual(payment.p_level, 300)
    247269        self.assertFalse(payment.p_current)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r9157 r9206  
    9797                return _('Study course data are incomplete.'), None
    9898            if previous_session:
     99                if previous_session < student['studycourse'].entry_session:
     100                    return _('The previous session must not fall below '
     101                             'your entry session.'), None
     102                if previous_session > student['studycourse'].current_session - 1:
     103                    return _('This is not a previous session.'), None
    99104                if previous_session == student['studycourse'].entry_session:
    100105                    if student.is_foreigner:
Note: See TracChangeset for help on using the changeset viewer.