Ignore:
Timestamp:
11 Jan 2013, 17:52:09 (12 years ago)
Author:
Henrik Bettermann
Message:

Add button and tests.

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

Legend:

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

    r9856 r9865  
    23812381        return
    23822382
     2383    def test_student_balance_payments(self):
     2384
     2385        # Login
     2386        self.browser.open(self.login_path)
     2387        self.browser.getControl(name="form.login").value = self.student_id
     2388        self.browser.getControl(name="form.password").value = 'spwd'
     2389        self.browser.getControl("Login").click()
     2390
     2391        # Students can add previous school fee payment tickets in any state.
     2392        IWorkflowState(self.student).setState('courses registered')
     2393        self.browser.open(self.payments_path)
     2394        self.browser.getLink("Add balance payment ticket").click()
     2395
     2396        # Previous session payment form is provided
     2397        self.assertEqual(self.student.current_session, 2004)
     2398        self.browser.getControl(name="form.balance_item").value = ['schoolfee']
     2399        self.browser.getControl(name="form.balance_session").value = ['2004']
     2400        self.browser.getControl(name="form.balance_level").value = ['300']
     2401        self.browser.getControl(name="form.balance_amount").value = '567.8'
     2402        self.browser.getControl("Create ticket").click()
     2403        self.assertMatches('...ticket created...',
     2404                           self.browser.contents)
     2405        ctrl = self.browser.getControl(name='val_id')
     2406        value = ctrl.options[0]
     2407        self.browser.getLink(value).click()
     2408        self.assertMatches('...Amount Authorized...',
     2409                           self.browser.contents)
     2410        self.assertEqual(self.student['payments'][value].amount_auth, 567.8)
     2411        # Payment attributes are properly set
     2412        self.assertEqual(self.student['payments'][value].p_session, 2004)
     2413        self.assertEqual(self.student['payments'][value].p_level, 300)
     2414        self.assertEqual(self.student['payments'][value].p_item, u'School Fee')
     2415        self.assertEqual(self.student['payments'][value].p_category, 'balance')
     2416
    23832417    def test_postgraduate_student_payments(self):
    23842418        configuration = createObject('waeup.SessionConfiguration')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r9814 r9865  
    620620        return self.view.url(self.view.context, self.target)
    621621
     622class AddBalancePaymentActionButton(AddActionButton):
     623    grok.order(3)
     624    grok.context(IStudentPaymentsContainer)
     625    grok.view(PaymentsManageFormPage)
     626    grok.require('waeup.payStudent')
     627    text = _('Add balance payment ticket')
     628    target = 'addbp'
     629
     630    @property
     631    def target_url(self):
     632        return self.view.url(self.view.context, self.target)
     633
    622634class StudentsTab(PrimaryNavTab):
    623635    """Students tab in primary navigation.
Note: See TracChangeset for help on using the changeset viewer.