Changeset 15970 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 31 Jan 2020, 12:12:17 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r15941 r15970 2960 2960 return 2961 2961 course = list(result)[0] 2962 if course.former_course: 2963 self.flash(_('Former courses can\'t be added.'), type="warning") 2964 return 2962 2965 addCourseTicket(self, course) 2963 2966 return … … 3083 3086 return 3084 3087 course = data['course'] 3088 if course.former_course: 3089 self.flash(_('Former courses can\'t be added.'), type="warning") 3090 return 3085 3091 success = addCourseTicket(self, course) 3086 3092 if success: -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r15918 r15970 3567 3567 self.assertEqual(self.student.state, 'courses registered') 3568 3568 3569 def test_former_course(self): 3570 IWorkflowState(self.student).setState('school fee paid') 3571 self.student['studycourse'].current_level = 100 3572 self.browser.open(self.login_path) 3573 self.browser.getControl(name="form.login").value = self.student_id 3574 self.browser.getControl(name="form.password").value = 'spwd' 3575 self.browser.getControl("Login").click() 3576 # Now students can add the current study level 3577 self.browser.getLink("Study Course").click() 3578 self.browser.getLink("Add course list").click() 3579 self.assertMatches('...Add current level 100 (Year 1)...', 3580 self.browser.contents) 3581 self.browser.getControl("Create course list now").click() 3582 # A level with one course ticket was created 3583 self.assertEqual( 3584 self.student['studycourse']['100'].number_of_tickets, 1) 3585 self.browser.getLink("100").click() 3586 self.assertTrue('<td>Unnamed Course</td>' in self.browser.contents) 3587 self.browser.getLink("Edit course list").click() 3588 del self.student['studycourse']['100']['COURSE1'] 3589 # Course can be added again via CourseTicketAddFormPage2 3590 self.browser.getLink("here").click() 3591 self.browser.getControl(name="form.course").value = ['COURSE1'] 3592 self.browser.getControl("Add course ticket").click() 3593 self.assertTrue('Successfully added COURSE1' in self.browser.contents) 3594 self.assertEqual(len(self.student['studycourse']['100'].keys()),1) 3595 del self.student['studycourse']['100']['COURSE1'] 3596 self.course.former_course = True 3597 self.browser.getLink("here").click() 3598 self.browser.getControl(name="form.course").value = ['COURSE1'] 3599 self.browser.getControl("Add course ticket").click() 3600 self.assertTrue('Former courses can\'t be added.' in self.browser.contents) 3601 self.assertEqual(len(self.student['studycourse']['100'].keys()),0) 3602 # Course can be added again via StudyLevelEditFormPage 3603 self.browser.getLink("100").click() 3604 self.browser.getLink("Edit course list").click() 3605 self.browser.getControl(name="course").value = 'COURSE1' 3606 self.browser.getControl("Add course ticket").click() 3607 self.assertTrue('Former courses can\'t be added.' in 3608 self.browser.contents) 3609 self.assertEqual(len(self.student['studycourse']['100'].keys()),0) 3610 # but added if current course 3611 self.course.former_course = False 3612 self.browser.getControl(name="course").value = 'COURSE1' 3613 self.browser.getControl("Add course ticket").click() 3614 self.assertTrue('Successfully added COURSE1' in self.browser.contents) 3615 self.assertEqual(len(self.student['studycourse']['100'].keys()),1) 3616 return 3569 3617 3570 3618 class StudentRequestPWTests(StudentsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.