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

Implement setPaymentDetails utility method.

File:
1 edited

Legend:

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

    r8473 r8598  
    3030from waeup.uniben.students.batching import CustomStudentProcessor
    3131from waeup.uniben.testing import FunctionalLayer
    32 from waeup.uniben.students.utils import get_school_fee
    3332from waeup.uniben.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
     
    317308        self.app['configuration']['2004'].maint_fee = 180.0
    318309        utils = getUtility(IStudentsUtils)
    319         self.assertEqual(utils.getPaymentDetails('schoolfee',self.student),
    320             {'p_level': 100, 'p_session': 2004, 'amount': 0.0,
    321             'p_item': u'CERT1', 'error': u'Amount could not be determined.'}
    322             )
    323         self.assertEqual(utils.getPaymentDetails('clearance',self.student),
    324             {'p_level': 100, 'p_session': 2004, 'amount': 34250.0,
    325             'p_item': u'CERT1', 'error': u''}
    326             )
    327         self.assertEqual(utils.getPaymentDetails('gown',self.student),
    328             {'p_level': 100, 'p_session': 2004, 'amount': 150.0,
    329             'p_item': u'', 'error': u''}
    330             )
    331         self.assertEqual(utils.getPaymentDetails('hostel_maintenance',self.student),
    332             {'p_level': 100, 'p_session': 2004, 'amount': 180.0,
    333             'p_item': u'', 'error': u''}
    334             )
    335         self.assertEqual(utils.getPaymentDetails('bed_allocation',self.student),
    336             {'p_level': 100, 'p_session': 2004, 'amount': 150.0,
    337             'p_item': u'', 'error': u''}
    338             )
    339         self.assertEqual(utils.getPaymentDetails('transfer',self.student),
    340             {'p_level': 100, 'p_session': 2004, 'amount': 90.0,
    341             'p_item': u'', 'error': u''}
    342             )
     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)
    343365        return
Note: See TracChangeset for help on using the changeset viewer.