Changeset 14259
- Timestamp:
- 5 Nov 2016, 05:59:51 (8 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py
r14252 r14259 182 182 return False 183 183 184 def _coursePaymentsMade(self, course): 185 if not course.code[:3] in ('GST', 'ENT'): 186 return True 187 if len(self.student['payments']): 188 paid_cats = list() 189 for pticket in self.student['payments'].values(): 190 if pticket.p_state == 'paid': 191 paid_cats.append(pticket.p_category) 192 if course.code in ('GST101', 'GST102', 'GST111', 'GST112') and \ 193 not 'gst_registration_1' in paid_cats: 194 return False 195 if course.code in ('GST222',) and \ 196 not 'gst_registration_2' in paid_cats: 197 return False 198 if course.code in ('ENT201',) and \ 199 not 'gst_registration_3' in paid_cats: 200 return False 201 if course.code in ('GST101', 'GST102') and \ 202 not 'gst_text_book_1' in paid_cats: 203 return False 204 if course.code in ('GST111', 'GST112') and \ 205 not 'gst_text_book_2' in paid_cats: 206 return False 207 if course.code in ('GST222',) and \ 208 not 'gst_text_book_3' in paid_cats: 209 return False 210 if course.code in ('ENT201',) and \ 211 not 'gst_text_book_4' in paid_cats: 212 return False 213 return True 214 return False 215 184 216 def addCourseTicket(self, ticket, course): 185 217 """Add a course ticket object. … … 194 226 _('%s is a 2nd semester course which can only be added ' 195 227 'if school fees have been fully paid.' % course.code)) 228 # Raise TicketError if registration fee or text 229 # book fee haven't been paid. 230 if not self._coursePaymentsMade(course): 231 raise TicketError( 232 _('%s can only be added if both registration fee and text ' 233 'book fee have been paid.' 234 % course.code)) 196 235 ticket.code = course.code 197 236 ticket.title = course.title -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r14252 r14259 831 831 return 832 832 833 def test_student_GST_registration(self): 834 configuration_1 = createObject('waeup.SessionConfiguration') 835 configuration_1.academic_session = 2015 836 configuration_1.gst_registration_1_fee = 3333.0 837 configuration_1.gst_text_book_1_fee = 4444.0 838 self.app['configuration'].addSessionConfiguration(configuration_1) 839 course = createObject('waeup.Course') 840 course.code = 'GST101' 841 course.semester = 1 842 course.credits = 10 843 course.passmark = 40 844 self.app['faculties']['fac1']['dep1'].courses.addCourse( 845 course) 846 self.app['faculties']['fac1']['dep1'].certificates[ 847 'CERT1'].addCertCourse(course, level=100) 848 IWorkflowState(self.student).setState('school fee paid') 849 self.student['studycourse'].entry_session = 2015 850 self.student['studycourse'].current_session = 2015 851 self.course.semester = 2 852 self.browser.open(self.login_path) 853 self.browser.getControl(name="form.login").value = self.student_id 854 self.browser.getControl(name="form.password").value = 'spwd' 855 self.browser.getControl("Login").click() 856 self.browser.getLink("Study Course").click() 857 self.browser.getLink("Add course list").click() 858 self.browser.getControl("Create course list now").click() 859 self.assertFalse('GST101' in self.browser.contents) 860 # GST101 tickets can't be added manually 861 self.browser.getLink("Edit course list").click() 862 self.browser.getLink("here").click() 863 self.browser.getControl(name="form.course").value = ['GST101'] 864 self.browser.getControl("Add course ticket").click() 865 self.assertTrue( 866 'GST101 can only be added if both registration fee and text' 867 in self.browser.contents) 868 # GST fees have to be paid first 869 self.browser.open(self.payments_path + '/addop') 870 self.browser.getControl(name="form.p_category").value = ['gst_registration_1'] 871 self.browser.getControl("Create ticket").click() 872 self.student['payments'].values()[0].approve() 873 self.browser.open(self.studycourse_path + '/100/ctadd') 874 self.browser.getControl(name="form.course").value = ['GST101'] 875 self.browser.getControl("Add course ticket").click() 876 self.assertTrue( 877 'GST101 can only be added if both registration fee and text' 878 in self.browser.contents) 879 self.browser.open(self.payments_path + '/addop') 880 self.browser.getControl(name="form.p_category").value = ['gst_text_book_1'] 881 self.browser.getControl("Create ticket").click() 882 self.student['payments'].values()[1].approve() 883 self.browser.open(self.studycourse_path + '/100/ctadd') 884 self.browser.getControl(name="form.course").value = ['GST101'] 885 self.browser.getControl("Add course ticket").click() 886 self.assertTrue('Successfully added GST101' in self.browser.contents) 887 return 888 833 889 def test_course_registration_forbidden(self): 834 890 IWorkflowState(self.student).setState('school fee paid')
Note: See TracChangeset for help on using the changeset viewer.