Changeset 13457 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 16 Nov 2015, 09:05:30 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r13455 r13457 1203 1203 # Managers can use HOS code and book a bed space with it 1204 1204 self.browser.open(self.acco_path) 1205 self.browser.get Link("Book accommodation").click()1205 self.browser.getControl("Book accommodation").click() 1206 1206 self.assertMatches('...You are in the wrong...', 1207 1207 self.browser.contents) … … 1210 1210 # are in accommodation session 1211 1211 self.student['studycourse'].current_session = 2003 1212 self.browser.get Link("Book accommodation").click()1212 self.browser.getControl("Book accommodation").click() 1213 1213 self.assertMatches('...Your current session does not match...', 1214 1214 self.browser.contents) 1215 1215 self.student['studycourse'].current_session = 2004 1216 1216 # All requirements are met and ticket can be created 1217 self.browser.get Link("Book accommodation").click()1217 self.browser.getControl("Book accommodation").click() 1218 1218 self.assertMatches('...Activation Code:...', 1219 1219 self.browser.contents) … … 1227 1227 self.assertTrue(bed1.owner == self.student_id) 1228 1228 # BedTicketAddPage is now blocked 1229 self.browser.get Link("Book accommodation").click()1229 self.browser.getControl("Book accommodation").click() 1230 1230 self.assertMatches('...You already booked a bed space...', 1231 1231 self.browser.contents) … … 3008 3008 3009 3009 def test_student_accommodation(self): 3010 # Create a second hostel with one bed 3011 hostel = Hostel() 3012 hostel.hostel_id = u'hall-2' 3013 hostel.hostel_name = u'Hall 2' 3014 self.app['hostels'].addHostel(hostel) 3015 bed = Bed() 3016 bed.bed_id = u'hall-2_A_101_A' 3017 bed.bed_number = 1 3018 bed.owner = NOT_OCCUPIED 3019 bed.bed_type = u'regular_female_fr' 3020 self.app['hostels'][hostel.hostel_id].addBed(bed) 3021 3010 3022 self.browser.open(self.login_path) 3011 3023 self.browser.getControl(name="form.login").value = self.student_id … … 3032 3044 # ... but not if booking period has expired ... 3033 3045 self.app['hostels'].enddate = datetime.now(pytz.utc) 3034 self.browser.get Link("Book accommodation").click()3046 self.browser.getControl("Book accommodation").click() 3035 3047 self.assertMatches('...Outside booking period: ...', 3036 3048 self.browser.contents) … … 3038 3050 # ... or student data are incomplete ... 3039 3051 self.student['studycourse'].current_level = None 3040 self.browser.get Link("Book accommodation").click()3052 self.browser.getControl("Book accommodation").click() 3041 3053 self.assertMatches('...Your data are incomplete...', 3042 3054 self.browser.contents) 3043 3055 self.student['studycourse'].current_level = 100 3044 3056 # ... or student is not the an allowed state ... 3045 self.browser.get Link("Book accommodation").click()3057 self.browser.getControl("Book accommodation").click() 3046 3058 self.assertMatches('...You are in the wrong...', 3047 3059 self.browser.contents) 3060 # Students can still not see the disired hostel selector. 3061 self.assertFalse('desired hostel' in self.browser.contents) 3048 3062 IWorkflowInfo(self.student).fireTransition('admit') 3049 self.browser.getLink("Book accommodation").click() 3063 # Students can now see the disired hostel selector. 3064 self.browser.reload() 3065 self.browser.open(self.acco_path) 3066 self.assertTrue('desired hostel' in self.browser.contents) 3067 self.browser.getControl(name="hostel").value = ['hall-2'] 3068 self.browser.getControl("Save").click() 3069 self.assertTrue('selection has been saved' in self.browser.contents) 3070 self.assertTrue('<option selected="selected" value="hall-2">' 3071 in self.browser.contents) 3072 self.browser.getControl("Book accommodation").click() 3050 3073 self.assertMatches('...Activation Code:...', 3051 3074 self.browser.contents) … … 3058 3081 # ... or ACs owned by somebody else. 3059 3082 ac.owner = u'Anybody' 3083 self.browser.getControl(name="ac_series").value = sfeseries 3084 self.browser.getControl(name="ac_number").value = sfenumber 3085 self.browser.getControl("Create bed ticket").click() 3086 # Hostel 2 has only a bed for women. 3087 self.assertTrue('There is no free bed in your desired hostel' 3088 in self.browser.contents) 3089 self.browser.getControl(name="hostel").value = ['hall-1'] 3090 self.browser.getControl("Save").click() 3091 self.browser.getControl("Book accommodation").click() 3092 # Student can't use faked ACs ... 3060 3093 self.browser.getControl(name="ac_series").value = sfeseries 3061 3094 self.browser.getControl(name="ac_number").value = sfenumber … … 3075 3108 self.assertTrue(bed.owner == self.student_id) 3076 3109 # BedTicketAddPage is now blocked. 3077 self.browser.get Link("Book accommodation").click()3110 self.browser.getControl("Book accommodation").click() 3078 3111 self.assertMatches('...You already booked a bed space...', 3079 3112 self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.