Ignore:
Timestamp:
4 Sep 2012, 07:06:20 (12 years ago)
Author:
Henrik Bettermann
Message:

Implement previous session payment.

File:
1 edited

Legend:

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

    r9006 r9152  
    221221        utils = getUtility(IStudentsUtils)
    222222
     223        self.student.nationality = u'NG'
     224
    223225        configuration = createObject('waeup.SessionConfiguration')
    224226        configuration.academic_session = 2005
    225227        self.app['configuration'].addSessionConfiguration(configuration)
    226228
    227         error, payment = utils.setPaymentDetails('schoolfee',self.student)
     229        error, payment = utils.setPaymentDetails('schoolfee',
     230            self.student, None, None)
    228231        self.assertEqual(payment, None)
    229         self.assertEqual(error, u'Amount could not be determined.')
    230 
     232        self.assertTrue(u'Amount could not be determined.' in error)
     233
     234        # Previous session payment, fresh and returning
     235        # are being distinguished by their entry_level
     236        error, payment = utils.setPaymentDetails('schoolfee',
     237            self.student, 2004, 300)
     238        self.assertEqual(payment.amount_auth, 40000.0)
     239        self.assertEqual(payment.p_session, 2004)
     240        self.assertEqual(payment.p_level, 300)
     241        self.assertFalse(payment.p_current)
     242        self.student['studycourse'].entry_session = 2003
     243        error, payment = utils.setPaymentDetails('schoolfee',
     244            self.student, 2004, 300)
     245        self.assertEqual(payment.amount_auth, 20000.0)
     246        self.assertEqual(payment.p_session, 2004)
     247        self.assertEqual(payment.p_level, 300)
     248        self.assertFalse(payment.p_current)
     249
     250        # Current payment, fresh and returning
     251        # are being distinguished by their state
    231252        IWorkflowState(self.student).setState('cleared')
    232         self.student.nationality = u'NG'
    233         error, payment = utils.setPaymentDetails('schoolfee',self.student)
     253        error, payment = utils.setPaymentDetails('schoolfee',
     254            self.student, None, None)
    234255        self.assertEqual(payment.p_level, 100)
    235256        self.assertEqual(payment.p_session, 2004)
     
    237258        self.assertEqual(payment.p_item, u'CERT1')
    238259        self.assertEqual(error, None)
     260        self.assertTrue(payment.p_current)
    239261
    240262        # Add penalty fee ...
     
    243265        # ... for returning
    244266        self.app['configuration']['2005'].penalty_ug = 88.0
    245         error, payment = utils.setPaymentDetails('schoolfee',self.student)
     267        error, payment = utils.setPaymentDetails('schoolfee',
     268            self.student, None, None)
    246269        self.assertEqual(payment.amount_auth, 40099.0)
    247270
    248271        IWorkflowState(self.student).setState('returning')
    249         error, payment = utils.setPaymentDetails('schoolfee',self.student)
     272        error, payment = utils.setPaymentDetails('schoolfee',
     273            self.student, None, None)
    250274        self.assertEqual(payment.p_level, 200)
    251275        self.assertEqual(payment.p_session, 2005)
     
    255279
    256280        self.student.is_staff = True
    257         error, payment = utils.setPaymentDetails('schoolfee',self.student)
     281        error, payment = utils.setPaymentDetails('schoolfee',
     282            self.student, None, None)
    258283        self.assertEqual(payment.p_level, 200)
    259284        self.assertEqual(payment.p_session, 2005)
     
    266291        self.student.nationality = u'DE'
    267292        self.certificate.school_fee_3 = 60000.0
    268         error, payment = utils.setPaymentDetails('schoolfee',self.student)
     293        error, payment = utils.setPaymentDetails(
     294            'schoolfee', self.student, None, None)
    269295        self.assertEqual(payment.p_level, 100)
    270296        self.assertEqual(payment.p_session, 2004)
     
    277303        self.student.nationality = u'DE'
    278304        self.certificate.school_fee_4 = 20000.0
    279         error, payment = utils.setPaymentDetails('schoolfee',self.student)
     305        error, payment = utils.setPaymentDetails(
     306            'schoolfee', self.student, None, None)
    280307        self.assertEqual(payment.p_level, 200)
    281308        self.assertEqual(payment.p_session, 2005)
     
    284311        self.assertEqual(error, None)
    285312
    286         error, payment = utils.setPaymentDetails('clearance',self.student)
     313        error, payment = utils.setPaymentDetails('clearance',
     314            self.student, None, None)
    287315        self.assertEqual(payment.p_level, 100)
    288316        self.assertEqual(payment.p_session, 2004)
     
    291319        self.assertEqual(error, None)
    292320
    293         error, payment = utils.setPaymentDetails('gown',self.student)
     321        error, payment = utils.setPaymentDetails('gown',
     322            self.student, None, None)
    294323        self.assertEqual(payment.p_level, 100)
    295324        self.assertEqual(payment.p_session, 2004)
     
    298327        self.assertEqual(error, None)
    299328
    300         error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
     329        error, payment = utils.setPaymentDetails('hostel_maintenance',
     330            self.student, None, None)
    301331        self.assertEqual(payment.p_level, 100)
    302332        self.assertEqual(payment.p_session, 2004)
     
    305335        self.assertEqual(error, None)
    306336
    307         error, payment = utils.setPaymentDetails('bed_allocation',self.student)
     337        error, payment = utils.setPaymentDetails('bed_allocation',
     338            self.student, None, None)
    308339        self.assertEqual(payment.p_level, 100)
    309340        self.assertEqual(payment.p_session, 2004)
     
    312343        self.assertEqual(error, None)
    313344
    314         error, payment = utils.setPaymentDetails('transfer',self.student)
     345        error, payment = utils.setPaymentDetails('transfer',
     346            self.student, None, None)
    315347        self.assertEqual(payment.p_level, 100)
    316348        self.assertEqual(payment.p_session, 2004)
Note: See TracChangeset for help on using the changeset viewer.