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

Configure setPaymentDetails, and add some basic tests.

File:
1 edited

Legend:

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

    r9155 r9244  
    7979        self.assertEqual(utils.getReturningData(self.student),(2005, 100))
    8080        return
     81
     82    def test_set_payment_details(self):
     83        self.app['configuration']['2004'].gown_fee = 150.0
     84        self.app['configuration']['2004'].transfer_fee = 90.0
     85        self.app['configuration']['2004'].booking_fee = 150.0
     86        self.app['configuration']['2004'].maint_fee = 180.0
     87        self.app['configuration']['2004'].clearance_fee = 120.0
     88        utils = getUtility(IStudentsUtils)
     89
     90        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     91        self.assertEqual(payment, None)
     92        self.assertEqual(error, u'Amount could not be determined.')
     93
     94        self.student.nationality = u'NG'
     95
     96        IWorkflowState(self.student).setState('cleared')
     97        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     98        self.assertEqual(payment.p_level, 100)
     99        self.assertEqual(payment.p_session, 2004)
     100        self.assertEqual(payment.amount_auth, 37000.0)
     101        self.assertEqual(payment.p_item, u'CERT1')
     102        self.assertEqual(error, None)
     103
     104        self.certificate.study_mode = 'jm_ft'
     105        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     106        self.assertEqual(payment.amount_auth, 72700.0)
     107
     108        IWorkflowState(self.student).setState('returning')
     109        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     110        self.assertEqual(payment.p_level, 100)
     111        self.assertEqual(payment.p_session, 2004)
     112        self.assertEqual(payment.amount_auth, 37000.0)
     113        self.assertEqual(payment.p_item, u'CERT1')
     114        self.assertEqual(error, None)
     115
     116        self.certificate.study_mode = 'ug_ft'
     117        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     118        self.assertEqual(payment.amount_auth, 20000.0)
     119
     120
     121        error, payment = utils.setPaymentDetails('clearance',self.student)
     122        self.assertEqual(payment.p_level, 100)
     123        self.assertEqual(payment.p_session, 2004)
     124        self.assertEqual(payment.amount_auth, 20000.0)
     125        self.assertEqual(payment.p_item, u'CERT1')
     126        self.assertEqual(error, None)
     127
     128        error, payment = utils.setPaymentDetails('schoolfee',self.student, 2004, 100)
     129        self.assertEqual(error, u'Previous session payment not yet implemented.')
     130        return
Note: See TracChangeset for help on using the changeset viewer.