Changeset 9504 for main/waeup.aaue/trunk/src/waeup/aaue/students
- Timestamp:
- 2 Nov 2012, 07:36:20 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r9433 r9504 298 298 self.assertEqual(error, u'Previous session payment not yet implemented.') 299 299 return 300 301 def test_student_course_registration(self): 302 303 # Add more courses 304 self.course2 = createObject('waeup.Course') 305 self.course2.code = 'COURSE2' 306 self.course2.semester = 2 307 self.course2.credits = 10 308 self.course2.passmark = 40 309 self.app['faculties']['fac1']['dep1'].courses.addCourse( 310 self.course2) 311 self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse( 312 self.course2, level=100) 313 self.course3 = createObject('waeup.Course') 314 self.course3.code = 'COURSE3' 315 self.course3.semester = 3 316 self.course3.credits = 10 317 self.course3.passmark = 40 318 self.app['faculties']['fac1']['dep1'].courses.addCourse( 319 self.course3) 320 self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse( 321 self.course3, level=100) 322 323 # Login as student 324 self.browser.open(self.login_path) 325 IWorkflowState(self.student).setState('school fee paid') 326 self.browser.open(self.login_path) 327 self.browser.getControl(name="form.login").value = self.student_id 328 self.browser.getControl(name="form.password").value = 'spwd' 329 self.browser.getControl("Login").click() 330 # Students can add the current study level 331 self.browser.getLink("Study Course").click() 332 self.browser.getLink("Add course list").click() 333 self.assertMatches('...Add current level 100 (Year 1)...', 334 self.browser.contents) 335 self.browser.getControl("Create course list now").click() 336 # Student has not paid second instalment, therefore a level 337 # with two course ticket was created (semester 1 and combined) 338 self.assertEqual(self.student['studycourse']['100'].number_of_tickets, 2) 339 self.browser.getLink("100").click() 340 self.browser.getLink("Edit course list").click() 341 self.browser.getControl("Add course ticket").click() 342 # Student can't add second semester course 343 self.assertTrue('<option value="COURSE1">' in self.browser.contents) 344 self.assertTrue('<option value="COURSE3">' in self.browser.contents) 345 self.assertFalse('<option value="COURSE2">' in self.browser.contents) 346 347 # Let's remove level and see what happens after 2nd instalment payment 348 del(self.student['studycourse']['100']) 349 payment2 = createObject('waeup.StudentOnlinePayment') 350 payment2.p_category = u'schoolfee_2' 351 payment2.p_session = self.student.current_session 352 self.student['payments']['anykey'] = payment2 353 self.browser.open(self.studycourse_path) 354 self.browser.getLink("Add course list").click() 355 self.browser.getControl("Create course list now").click() 356 # Still only 2 tickets have been created since payment ticket 357 # was not paid 358 self.assertEqual(self.student['studycourse']['100'].number_of_tickets, 2) 359 payment2.p_state = u'paid' 360 del(self.student['studycourse']['100']) 361 self.browser.open(self.studycourse_path) 362 self.browser.getLink("Add course list").click() 363 self.browser.getControl("Create course list now").click() 364 # Now 2nd semester course has been added 365 self.assertEqual(self.student['studycourse']['100'].number_of_tickets, 3) 366 # Student can add second semester course 367 self.browser.getLink("100").click() 368 self.browser.getLink("Edit course list").click() 369 self.browser.getControl("Add course ticket").click() 370 self.assertTrue('<option value="COURSE1">' in self.browser.contents) 371 self.assertTrue('<option value="COURSE2">' in self.browser.contents) 372 self.assertTrue('<option value="COURSE3">' in self.browser.contents) 373 return
Note: See TracChangeset for help on using the changeset viewer.