Ignore:
Timestamp:
4 Nov 2012, 19:54:18 (12 years ago)
Author:
Henrik Bettermann
Message:

Adjust to changes made in base package.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene/students
Files:
1 added
2 edited

Legend:

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

    r9434 r9525  
    9393        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    9494        self.browser.open(self.payments_path)
    95         self.browser.getControl("Add online payment ticket").click()
     95        self.browser.getLink("Add current session payment ticket").click()
    9696        self.browser.getControl("Create ticket").click()
    9797        self.assertMatches('...Amount could not be determined...',
     
    164164        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    165165        self.browser.getControl("Create ticket").click()
    166         self.assertMatches('...ticket created...',
    167                            self.browser.contents)
     166        # Uups, we forgot to add a session configuration for next session
     167        self.assertTrue('Session configuration object is not available.'
     168            in self.browser.contents)
     169        configuration = createObject('waeup.SessionConfiguration')
     170        configuration.academic_session = 2005
     171        self.app['configuration'].addSessionConfiguration(configuration)
     172        self.browser.getControl("Create ticket").click()
     173        self.assertMatches('...ticket created...',
     174                           self.browser.contents)
     175
    168176        # In state admitted school fee can't be determined
    169177        IWorkflowState(self.student).setState('admitted')
     
    174182                           self.browser.contents)
    175183
    176         # If the session configuration doesn't exist an error message will
    177         # be shown. No other requirement is being checked.
    178         del self.app['configuration']['2004']
    179         self.browser.open(self.payments_path)
    180         self.browser.getControl("Add online payment ticket").click()
    181         self.browser.getControl("Create ticket").click()
    182         self.assertMatches('...Session configuration object is not...',
    183                            self.browser.contents)
     184    def test_student_payments(self):
     185        # Login
     186        IWorkflowState(self.student).setState('returning')
     187        self.browser.open(self.login_path)
     188        self.browser.getControl(name="form.login").value = self.student_id
     189        self.browser.getControl(name="form.password").value = 'spwd'
     190        self.browser.getControl("Login").click()
     191        self.browser.open(self.student_path + '/payments')
     192        self.assertTrue(
     193          'Add current session payment ticket' in self.browser.contents)
     194        self.assertFalse(
     195          'Add previous session payment ticket' in self.browser.contents)
     196        return
    184197
    185198    def test_get_returning_data(self):
     
    214227
    215228        IWorkflowState(self.student).setState('returning')
     229        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     230        self.assertEqual('Session configuration object is not available.', error)
     231        configuration = createObject('waeup.SessionConfiguration')
     232        configuration.academic_session = 2005
     233        self.app['configuration'].addSessionConfiguration(configuration)
    216234        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    217235        self.assertEqual(payment.p_level, 200)
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py

    r9297 r9525  
    7171        p_level = student['studycourse'].current_level
    7272        p_current = True
    73         session = str(p_session)
    74         try:
    75             academic_session = grok.getSite()['configuration'][session]
    76         except KeyError:
     73        academic_session = self._getSessionConfiguration(p_session)
     74        if academic_session == None:
    7775            return _(u'Session configuration object is not available.'), None
     76        # Determine fee.
    7877        if category == 'transfer':
    7978            amount = academic_session.transfer_fee
     
    202201                        amount = 17400
    203202            if student.state == RETURNING:
     203                # Override p_session and p_level
    204204                p_session, p_level = self.getReturningData(student)
     205                academic_session = self._getSessionConfiguration(p_session)
     206                if academic_session == None:
     207                    return _(u'Session configuration object is not available.'), None
    205208
    206209        if amount in (0.0, None):
Note: See TracChangeset for help on using the changeset viewer.