Changeset 8320
- Timestamp:
- 2 May 2012, 05:10:36 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r8306 r8320 21 21 from hurry.workflow.interfaces import IWorkflowState 22 22 from zope.component.hooks import setSite, clearSite 23 from zope.component import getUtility 23 24 from waeup.kofa.app import University 24 25 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 25 26 from waeup.kofa.testing import FunctionalTestCase 26 27 from waeup.kofa.students.batching import StudentProcessor 28 from waeup.kofa.students.interfaces import IStudentsUtils 27 29 from waeup.uniben.students.batching import CustomStudentProcessor 28 30 from waeup.uniben.testing import FunctionalLayer 31 from waeup.uniben.students.utils import get_school_fee 32 29 33 30 34 STUDENT_SAMPLE_DATA = open( … … 218 222 self.assertMatches('...ticket created...', 219 223 self.browser.contents) 224 # In state admitted school fee can't be determined 220 225 IWorkflowState(self.student).setState('admitted') 221 226 self.browser.open(self.payments_path + '/addop') … … 247 252 self.assertTrue('Save' in self.browser.contents) 248 253 249 254 def test_get_returning_data(self): 255 # Student is in level 100, session 2004 with verdict A 256 utils = getUtility(IStudentsUtils) 257 self.assertEqual(utils.getReturningData(self.student),(2005, 200)) 258 self.student['studycourse'].current_verdict = 'C' 259 self.assertEqual(utils.getReturningData(self.student),(2005, 110)) 260 self.student['studycourse'].current_verdict = 'D' 261 self.assertEqual(utils.getReturningData(self.student),(2005, 100)) 262 return 263 264 def test_get_schoolfee(self): 265 self.assertEqual(get_school_fee(self.student),0.0) 266 IWorkflowState(self.student).setState('cleared') 267 self.assertEqual(get_school_fee(self.student),40000.0) 268 IWorkflowState(self.student).setState('returning') 269 self.assertEqual(get_school_fee(self.student),20000.0) 270 return 271 272 def test_get_payment_details(self): 273 self.app['configuration']['2004'].gown_fee = 150.0 274 self.app['configuration']['2004'].transfer_fee = 90.0 275 self.app['configuration']['2004'].booking_fee = 150.0 276 self.app['configuration']['2004'].maint_fee = 180.0 277 utils = getUtility(IStudentsUtils) 278 self.assertEqual(utils.getPaymentDetails('schoolfee',self.student), 279 {'p_level': 100, 'p_session': 2004, 'amount': 0.0, 280 'p_item': u'CERT1', 'error': u'Amount could not be determined.'} 281 ) 282 self.assertEqual(utils.getPaymentDetails('clearance',self.student), 283 {'p_level': 100, 'p_session': 2004, 'amount': 34250.0, 284 'p_item': u'CERT1', 'error': u''} 285 ) 286 self.assertEqual(utils.getPaymentDetails('gown',self.student), 287 {'p_level': 100, 'p_session': 2004, 'amount': 150.0, 288 'p_item': u'', 'error': u''} 289 ) 290 self.assertEqual(utils.getPaymentDetails('hostel_maintenance',self.student), 291 {'p_level': 100, 'p_session': 2004, 'amount': 180.0, 292 'p_item': u'', 'error': u''} 293 ) 294 self.assertEqual(utils.getPaymentDetails('bed_allocation',self.student), 295 {'p_level': 100, 'p_session': 2004, 'amount': 150.0, 296 'p_item': u'', 'error': u''} 297 ) 298 self.assertEqual(utils.getPaymentDetails('transfer',self.student), 299 {'p_level': 100, 'p_session': 2004, 'amount': 90.0, 300 'p_item': u'', 'error': u''} 301 ) 302 return
Note: See TracChangeset for help on using the changeset viewer.