Changeset 9938 for main/waeup.kofa/trunk


Ignore:
Timestamp:
7 Feb 2013, 15:50:15 (12 years ago)
Author:
Henrik Bettermann
Message:

Change permissions so that only student managers can add balance payment tickets.

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

Legend:

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

    r9933 r9938  
    15491549    grok.context(IStudentPaymentsContainer)
    15501550    grok.name('addbp')
    1551     grok.require('waeup.payStudent')
     1551    grok.require('waeup.manageStudent')
    15521552    form_fields = grok.AutoFields(IStudentBalancePayment)
    15531553    label = _('Add balance')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9929 r9938  
    946946        self.assertEqual(ac.cost, 3456.0)
    947947        return
     948
     949    def test_manage_balance_payments(self):
     950
     951        # Login
     952        #self.browser.open(self.login_path)
     953        #self.browser.getControl(name="form.login").value = self.student_id
     954        #self.browser.getControl(name="form.password").value = 'spwd'
     955        #self.browser.getControl("Login").click()
     956
     957        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     958        self.browser.open(self.payments_path)
     959
     960        # Managers can add previous school fee payment tickets in any state.
     961        IWorkflowState(self.student).setState('courses registered')
     962        self.browser.open(self.payments_path)
     963        self.browser.getLink("Add balance payment ticket").click()
     964
     965        # Previous session payment form is provided
     966        self.assertEqual(self.student.current_session, 2004)
     967        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     968        self.browser.getControl(name="form.balance_session").value = ['2004']
     969        self.browser.getControl(name="form.balance_level").value = ['300']
     970        self.browser.getControl(name="form.balance_amount").value = '-567.8'
     971        self.browser.getControl("Create ticket").click()
     972        self.assertMatches('...Amount must be greater than 0...',
     973                           self.browser.contents)
     974        self.browser.getControl(name="form.balance_amount").value = '0'
     975        self.browser.getControl("Create ticket").click()
     976        self.assertMatches('...Amount must be greater than 0...',
     977                           self.browser.contents)
     978        self.browser.getControl(name="form.balance_amount").value = '567.8'
     979        self.browser.getControl("Create ticket").click()
     980        self.assertMatches('...ticket created...',
     981                           self.browser.contents)
     982        ctrl = self.browser.getControl(name='val_id')
     983        value = ctrl.options[0]
     984        self.browser.getLink(value).click()
     985        self.assertMatches('...Amount Authorized...',
     986                           self.browser.contents)
     987        self.assertEqual(self.student['payments'][value].amount_auth, 567.8)
     988        # Payment attributes are properly set
     989        self.assertEqual(self.student['payments'][value].p_session, 2004)
     990        self.assertEqual(self.student['payments'][value].p_level, 300)
     991        self.assertEqual(self.student['payments'][value].p_item, u'Balance')
     992        self.assertEqual(self.student['payments'][value].p_category, 'schoolfee')
    948993
    949994    def test_manage_accommodation(self):
     
    24152460        return
    24162461
    2417     def test_student_balance_payments(self):
    2418 
    2419         # Login
    2420         self.browser.open(self.login_path)
    2421         self.browser.getControl(name="form.login").value = self.student_id
    2422         self.browser.getControl(name="form.password").value = 'spwd'
    2423         self.browser.getControl("Login").click()
    2424 
    2425         # Students can add previous school fee payment tickets in any state.
    2426         IWorkflowState(self.student).setState('courses registered')
    2427         self.browser.open(self.payments_path)
    2428         self.browser.getLink("Add balance payment ticket").click()
    2429 
    2430         # Previous session payment form is provided
    2431         self.assertEqual(self.student.current_session, 2004)
    2432         self.browser.getControl(name="form.p_category").value = ['schoolfee']
    2433         self.browser.getControl(name="form.balance_session").value = ['2004']
    2434         self.browser.getControl(name="form.balance_level").value = ['300']
    2435         self.browser.getControl(name="form.balance_amount").value = '-567.8'
    2436         self.browser.getControl("Create ticket").click()
    2437         self.assertMatches('...Amount must be greater than 0...',
    2438                            self.browser.contents)
    2439         self.browser.getControl(name="form.balance_amount").value = '0'
    2440         self.browser.getControl("Create ticket").click()
    2441         self.assertMatches('...Amount must be greater than 0...',
    2442                            self.browser.contents)
    2443         self.browser.getControl(name="form.balance_amount").value = '567.8'
    2444         self.browser.getControl("Create ticket").click()
    2445         self.assertMatches('...ticket created...',
    2446                            self.browser.contents)
    2447         ctrl = self.browser.getControl(name='val_id')
    2448         value = ctrl.options[0]
    2449         self.browser.getLink(value).click()
    2450         self.assertMatches('...Amount Authorized...',
    2451                            self.browser.contents)
    2452         self.assertEqual(self.student['payments'][value].amount_auth, 567.8)
    2453         # Payment attributes are properly set
    2454         self.assertEqual(self.student['payments'][value].p_session, 2004)
    2455         self.assertEqual(self.student['payments'][value].p_level, 300)
    2456         self.assertEqual(self.student['payments'][value].p_item, u'Balance')
    2457         self.assertEqual(self.student['payments'][value].p_category, 'schoolfee')
    2458 
    24592462    def test_postgraduate_student_payments(self):
    24602463        configuration = createObject('waeup.SessionConfiguration')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py

    r9924 r9938  
    624624    grok.context(IStudentPaymentsContainer)
    625625    grok.view(PaymentsManageFormPage)
    626     grok.require('waeup.payStudent')
     626    grok.require('waeup.manageStudent')
    627627    text = _('Add balance payment ticket')
    628628    target = 'addbp'
Note: See TracChangeset for help on using the changeset viewer.