Ignore:
Timestamp:
10 Nov 2013, 07:35:27 (11 years ago)
Author:
Henrik Bettermann
Message:

Adjust setPaymentDetails.

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

Legend:

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

    r10705 r10735  
    8686        self.student['accommodation'].addBedTicket(bedticket)
    8787
    88     def test_manage_payments(self):
    89         # Add missing configuration data
    9088        self.app['configuration']['2004'].gown_fee = 150.0
    9189        self.app['configuration']['2004'].transfer_fee = 90.0
     
    9391        self.app['configuration']['2004'].booking_fee = 150.0
    9492        self.app['configuration']['2004'].maint_fee = 180.0
    95 
     93        self.app['configuration']['2004'].certificate_fee = 444.0
     94
     95    def test_manage_payments(self):
    9696        # Managers can add online payment tickets
    9797        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    177177        self.browser.getControl("Create ticket").click()
    178178        self.assertMatches('...Amount could not be determined...',
     179                           self.browser.contents)
     180        self.browser.open(self.payments_path + '/addop')
     181        self.browser.getControl(name="form.p_category").value = ['certificate']
     182        self.browser.getControl("Create ticket").click()
     183        self.assertMatches('...ticket created...',
    179184                           self.browser.contents)
    180185
     
    204209
    205210    def test_set_payment_details(self):
    206         self.app['configuration']['2004'].gown_fee = 150.0
    207         self.app['configuration']['2004'].transfer_fee = 90.0
    208         self.app['configuration']['2004'].booking_fee = 150.0
    209         self.app['configuration']['2004'].maint_fee = 180.0
    210         self.app['configuration']['2004'].clearance_fee = 120.0
    211211        utils = getUtility(IStudentsUtils)
    212212
     
    301301        self.assertEqual(payment.amount_auth, 150.0)
    302302        self.assertEqual(payment.p_item, u'')
     303        self.assertEqual(error, None)
     304
     305        error, payment = utils.setPaymentDetails('certificate',self.student)
     306        self.assertEqual(payment.p_level, 100)
     307        self.assertEqual(payment.p_session, 2004)
     308        self.assertEqual(payment.amount_auth, 444.0)
     309        self.assertEqual(payment.p_item, u'')
     310        self.assertEqual(payment.p_category, 'certificate')
    303311        self.assertEqual(error, None)
    304312
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/utils.py

    r10708 r10735  
    233233        elif category == 'carryover3':
    234234            amount = 8000.0
     235
     236        else:
     237            fee_name = category + '_fee'
     238            amount = getattr(academic_session, fee_name, 0.0)
    235239        if amount in (0.0, None):
    236240            return _(u'Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.