Changeset 9526 for main/waeup.kwarapoly


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

Adjust to changes made in base package.

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

Legend:

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

    r9436 r9526  
    9595        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    9696        self.browser.open(self.payments_path)
    97         self.browser.getControl("Add online payment ticket").click()
     97        self.browser.getLink("Add current session payment ticket").click()
    9898        self.browser.getControl("Create ticket").click()
    9999        self.assertMatches('...Amount could not be determined...',
     
    166166        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    167167        self.browser.getControl("Create ticket").click()
     168        # Uups, we forgot to add a session configuration for next session
     169        self.assertTrue('Session configuration object is not available.'
     170            in self.browser.contents)
     171        configuration = createObject('waeup.SessionConfiguration')
     172        configuration.academic_session = 2005
     173        self.app['configuration'].addSessionConfiguration(configuration)
     174        self.browser.getControl("Create ticket").click()
    168175        self.assertMatches('...ticket created...',
    169176                           self.browser.contents)
     
    176183                           self.browser.contents)
    177184
    178         # If the session configuration doesn't exist an error message will
    179         # be shown. No other requirement is being checked.
    180         del self.app['configuration']['2004']
    181         self.browser.open(self.payments_path)
    182         self.browser.getControl("Add online payment ticket").click()
    183         self.browser.getControl("Create ticket").click()
    184         self.assertMatches('...Session configuration object is not...',
    185                            self.browser.contents)
     185    def test_student_payments(self):
     186        # Login
     187        IWorkflowState(self.student).setState('returning')
     188        self.browser.open(self.login_path)
     189        self.browser.getControl(name="form.login").value = self.student_id
     190        self.browser.getControl(name="form.password").value = 'spwd'
     191        self.browser.getControl("Login").click()
     192        self.browser.open(self.student_path + '/payments')
     193        self.assertTrue(
     194          'Add current session payment ticket' in self.browser.contents)
     195        self.assertFalse(
     196          'Add previous session payment ticket' in self.browser.contents)
     197        return
    186198
    187199    def test_get_returning_data(self):
     
    220232
    221233        IWorkflowState(self.student).setState('returning')
     234        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     235        self.assertEqual('Session configuration object is not available.', error)
     236        configuration = createObject('waeup.SessionConfiguration')
     237        configuration.academic_session = 2005
     238        self.app['configuration'].addSessionConfiguration(configuration)
    222239        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    223240        self.assertEqual(payment.p_level, 200)
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/utils.py

    r9396 r9526  
    126126        p_level = student['studycourse'].current_level
    127127        p_current = True
    128         session = str(p_session)
    129         try:
    130             academic_session = grok.getSite()['configuration'][session]
    131         except KeyError:
     128        academic_session = self._getSessionConfiguration(p_session)
     129        if academic_session == None:
    132130            return _(u'Session configuration object is not available.'), None
     131        # Determine fee.
    133132        if category == 'transfer':
    134133            amount = academic_session.transfer_fee
     
    152151                return _('Study course data are incomplete.'), None
    153152            if student.state == RETURNING:
     153                # Override p_session and p_level
    154154                p_session, p_level = self.getReturningData(student)
     155                academic_session = self._getSessionConfiguration(p_session)
     156                if academic_session == None:
     157                    return _(u'Session configuration object is not available.'), None
    155158            if student.state in (RETURNING, CLEARED):
    156159                if p_level in PAYMENT_LEVELS:
Note: See TracChangeset for help on using the changeset viewer.