Changeset 9526 for main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students
- Timestamp:
- 4 Nov 2012, 19:59:50 (12 years ago)
- 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 95 95 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 96 96 self.browser.open(self.payments_path) 97 self.browser.get Control("Add onlinepayment ticket").click()97 self.browser.getLink("Add current session payment ticket").click() 98 98 self.browser.getControl("Create ticket").click() 99 99 self.assertMatches('...Amount could not be determined...', … … 166 166 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 167 167 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() 168 175 self.assertMatches('...ticket created...', 169 176 self.browser.contents) … … 176 183 self.browser.contents) 177 184 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 186 198 187 199 def test_get_returning_data(self): … … 220 232 221 233 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) 222 239 error, payment = utils.setPaymentDetails('schoolfee',self.student) 223 240 self.assertEqual(payment.p_level, 200) -
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/students/utils.py
r9396 r9526 126 126 p_level = student['studycourse'].current_level 127 127 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: 132 130 return _(u'Session configuration object is not available.'), None 131 # Determine fee. 133 132 if category == 'transfer': 134 133 amount = academic_session.transfer_fee … … 152 151 return _('Study course data are incomplete.'), None 153 152 if student.state == RETURNING: 153 # Override p_session and p_level 154 154 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 155 158 if student.state in (RETURNING, CLEARED): 156 159 if p_level in PAYMENT_LEVELS:
Note: See TracChangeset for help on using the changeset viewer.