Changeset 13283 for main/waeup.uniben/trunk/src
- Timestamp:
- 6 Oct 2015, 07:37:06 (9 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r13252 r13283 907 907 908 908 def test_student_accommodation(self): 909 bed = Bed() 910 bed.bed_id = u'hall-1_A_101_C' 911 bed.bed_number = 3 912 bed.owner = NOT_OCCUPIED 913 bed.bed_type = u'regular_male_fi' 914 self.app['hostels']['hall-1'].addBed(bed) 909 915 self.browser.open(self.login_path) 910 916 self.browser.getControl(name="form.login").value = self.student_id … … 941 947 self.assertMatches('...Your data are incomplete...', 942 948 self.browser.contents) 943 self.student['studycourse'].current_level = 100 949 self.student['studycourse'].current_level = 200 950 # ... or student is not the an allowed state ... 951 self.browser.getLink("Book accommodation").click() 952 self.assertMatches('...You are in the wrong...', 953 self.browser.contents) 954 self.app['hostels'].accommodation_states = ['admitted', 'school fee paid'] 955 IWorkflowState(self.student).setState('school fee paid') 944 956 # ... or student has not appropriate verdict (Uniben only!) 957 self.student['studycourse'].entry_session = 2000 # non-fresh 958 self.student['studycourse'].current_level = 500 # final-year 945 959 self.student['studycourse'].current_verdict = 'C' 946 960 self.browser.getLink("Book accommodation").click() … … 948 962 self.browser.contents) 949 963 self.student['studycourse'].current_verdict = 'A' 950 # ... or student is not the an allowed state ...951 self.browser.getLink("Book accommodation").click()952 self.assertMatches('...You are in the wrong...',953 self.browser.contents)954 IWorkflowInfo(self.student).fireTransition('admit')955 964 self.browser.getLink("Book accommodation").click() 956 965 self.assertMatches('...Activation Code:...', … … 970 979 self.browser.contents) 971 980 # The bed remains empty. 972 bed = self.app['hostels']['hall-1']['hall-1_A_101_ A']981 bed = self.app['hostels']['hall-1']['hall-1_A_101_C'] 973 982 self.assertTrue(bed.owner == NOT_OCCUPIED) 974 983 ac.owner = self.student_id … … 976 985 self.browser.getControl(name="ac_number").value = sfenumber 977 986 self.browser.getControl("Create bed ticket").click() 978 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',987 self.assertMatches('...Hall 1, Block A, Room 101, Bed C...', 979 988 self.browser.contents) 980 989 # Bed has been allocated. … … 986 995 # The bed ticket displays the data correctly. 987 996 self.browser.open(self.acco_path + '/2004') 988 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',997 self.assertMatches('...Hall 1, Block A, Room 101, Bed C...', 989 998 self.browser.contents) 990 999 self.assertMatches('...2004/2005...', self.browser.contents) 991 self.assertMatches('...regular_male_f r...', self.browser.contents)1000 self.assertMatches('...regular_male_fi...', self.browser.contents) 992 1001 self.assertMatches('...%s...' % pin, self.browser.contents) 993 1002 # Students can open the pdf slip. -
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r13252 r13283 65 65 else: 66 66 return _("Outside booking period.") 67 if not student.current_verdict in ('A', 'B'): 68 return _("Your are not eligible to book accommodation.") 69 if not acc_details.get('bt'): 67 bt = acc_details.get('bt') 68 if not bt: 70 69 return _("Your data are incomplete.") 71 70 if not student.state in acc_details['allowed_states']: … … 75 74 return _('Your current session does not ' 76 75 'match accommodation session.') 76 stage = bt.split('_')[2] 77 if stage not in ('fr', 'fi'): 78 return _("Only fresh and final year students are allowed to book accommodation.") 79 if stage != 'fr' and not student.current_verdict in ('A', 'B'): 80 return _("Your are not eligible to book accommodation.") 77 81 if str(acc_details['booking_session']) in student['accommodation'].keys(): 78 82 return _('You already booked a bed space in ' … … 137 141 p_item = self.getAccommodationDetails(student)['bt'] 138 142 amount = academic_session.booking_fee 143 # Add student union dues 144 stage = self.getAccommodationDetails(student)['bt'] 145 stage = stage.split('_')[2] 146 if stage == 'fr': 147 amount += 500.0 148 else: 149 amount += 300.0 139 150 elif category == 'hostel_maintenance': 140 151 amount = 0.0
Note: See TracChangeset for help on using the changeset viewer.