Ignore:
Timestamp:
2 Jun 2012, 08:12:18 (13 years ago)
Author:
Henrik Bettermann
Message:

See waeup.uniben.

File:
1 edited

Legend:

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

    r8505 r8600  
    3030from waeup.aaue.students.batching import CustomStudentProcessor
    3131from waeup.aaue.testing import FunctionalLayer
    32 from waeup.aaue.students.utils import get_school_fee
    3332from waeup.aaue.students.interfaces import (
    3433    ICustomStudentStudyCourse, ICustomStudent,
     
    303302        return
    304303
    305     def test_get_schoolfee(self):
    306         self.assertEqual(get_school_fee(self.student),0.0)
    307         IWorkflowState(self.student).setState('cleared')
    308         self.assertEqual(get_school_fee(self.student),40000.0)
    309         IWorkflowState(self.student).setState('returning')
    310         self.assertEqual(get_school_fee(self.student),20000.0)
    311         return
    312 
    313     def test_get_payment_details(self):
     304    def test_set_payment_details(self):
    314305        self.app['configuration']['2004'].gown_fee = 150.0
    315306        self.app['configuration']['2004'].transfer_fee = 90.0
    316307        self.app['configuration']['2004'].booking_fee = 150.0
    317308        self.app['configuration']['2004'].maint_fee = 180.0
    318         self.app['configuration']['2004'].clearance_fee = 360.0
    319309        utils = getUtility(IStudentsUtils)
    320         self.assertEqual(utils.getPaymentDetails('schoolfee',self.student),
    321             {'p_level': 100, 'p_session': 2004, 'amount': 0.0,
    322             'p_item': u'CERT1', 'error': u'Amount could not be determined.'}
    323             )
    324         self.assertEqual(utils.getPaymentDetails('clearance',self.student),
    325             {'p_level': 100, 'p_session': 2004, 'amount': 360.0,
    326             'p_item': u'CERT1', 'error': u''}
    327             )
    328         self.assertEqual(utils.getPaymentDetails('gown',self.student),
    329             {'p_level': 100, 'p_session': 2004, 'amount': 150.0,
    330             'p_item': u'', 'error': u''}
    331             )
    332         self.assertEqual(utils.getPaymentDetails('hostel_maintenance',self.student),
    333             {'p_level': 100, 'p_session': 2004, 'amount': 180.0,
    334             'p_item': u'', 'error': u''}
    335             )
    336         self.assertEqual(utils.getPaymentDetails('bed_allocation',self.student),
    337             {'p_level': 100, 'p_session': 2004, 'amount': 150.0,
    338             'p_item': u'', 'error': u''}
    339             )
    340         self.assertEqual(utils.getPaymentDetails('transfer',self.student),
    341             {'p_level': 100, 'p_session': 2004, 'amount': 90.0,
    342             'p_item': u'', 'error': u''}
    343             )
     310
     311        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     312        self.assertEqual(payment, None)
     313        self.assertEqual(error, u'Amount could not be determined.')
     314
     315        IWorkflowState(self.student).setState('cleared')
     316        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     317        self.assertEqual(payment.p_level, 100)
     318        self.assertEqual(payment.p_session, 2004)
     319        self.assertEqual(payment.amount_auth, 40000.0)
     320        self.assertEqual(payment.p_item, u'CERT1')
     321        self.assertEqual(error, None)
     322
     323        IWorkflowState(self.student).setState('returning')
     324        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     325        self.assertEqual(payment.p_level, 200)
     326        self.assertEqual(payment.p_session, 2005)
     327        self.assertEqual(payment.amount_auth, 20000.0)
     328        self.assertEqual(payment.p_item, u'CERT1')
     329        self.assertEqual(error, None)
     330
     331        error, payment = utils.setPaymentDetails('clearance',self.student)
     332        self.assertEqual(payment.p_level, 100)
     333        self.assertEqual(payment.p_session, 2004)
     334        self.assertEqual(payment.amount_auth, 34250.0)
     335        self.assertEqual(payment.p_item, u'CERT1')
     336        self.assertEqual(error, None)
     337
     338        error, payment = utils.setPaymentDetails('gown',self.student)
     339        self.assertEqual(payment.p_level, 100)
     340        self.assertEqual(payment.p_session, 2004)
     341        self.assertEqual(payment.amount_auth, 150.0)
     342        self.assertEqual(payment.p_item, u'')
     343        self.assertEqual(error, None)
     344
     345        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
     346        self.assertEqual(payment.p_level, 100)
     347        self.assertEqual(payment.p_session, 2004)
     348        self.assertEqual(payment.amount_auth, 180.0)
     349        self.assertEqual(payment.p_item, u'')
     350        self.assertEqual(error, None)
     351
     352        error, payment = utils.setPaymentDetails('bed_allocation',self.student)
     353        self.assertEqual(payment.p_level, 100)
     354        self.assertEqual(payment.p_session, 2004)
     355        self.assertEqual(payment.amount_auth, 150.0)
     356        self.assertEqual(payment.p_item, u'')
     357        self.assertEqual(error, None)
     358
     359        error, payment = utils.setPaymentDetails('transfer',self.student)
     360        self.assertEqual(payment.p_level, 100)
     361        self.assertEqual(payment.p_session, 2004)
     362        self.assertEqual(payment.amount_auth, 90.0)
     363        self.assertEqual(payment.p_item, u'')
     364        self.assertEqual(error, None)
    344365        return
Note: See TracChangeset for help on using the changeset viewer.