Changeset 7045 for main/waeup.sirp/trunk
- Timestamp:
- 8 Nov 2011, 22:18:28 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py
r7003 r7045 34 34 from waeup.sirp.hostels.hostel import Hostel, Bed 35 35 from waeup.sirp.testing import (FunctionalLayer, FunctionalTestCase) 36 from waeup.sirp.students.student import Student 37 from waeup.sirp.students.accommodation import BedTicket 36 38 37 39 class HostelsContainerTestCase(FunctionalTestCase): … … 95 97 setSite(app) 96 98 99 # Add student with subobjects 100 student = Student() 101 student.fullname = u'Anna Tester' 102 student.reg_number = u'123' 103 student.matric_number = u'234' 104 student.sex = u'f' 105 self.app['students'].addStudent(student) 106 self.student_id = student.student_id 107 self.student = self.app['students'][self.student_id] 108 self.student['studycourse'].current_session = 2004 109 self.student['studycourse'].entry_session = 2004 110 111 # Set accommodation_session 112 self.app['configuration'].accommodation_session = 2004 113 97 114 # Create a hostel 98 115 hostel = Hostel() … … 126 143 127 144 def test_get_catalog(self): 128 # We can get a n students catalog if we wish145 # We can get a beds catalog if we wish 129 146 cat = queryUtility(ICatalog, name='beds_catalog') 130 147 assert cat is not None … … 244 261 'hall-1_A_101_D'].bed_type == 'regular_female_all' 245 262 self.assertFalse(expected in self.browser.contents) 263 # Release bed which has previously been booked 264 bedticket = BedTicket() 265 bedticket.ticket_id = u'2004' 266 bedticket.bed_coordinates = u'anything' 267 self.student['accommodation'].addBedTicket(bedticket) 268 self.app['hostels']['hall-1']['hall-1_A_101_D'].owner = self.student_id 269 self.browser.open(self.container_path + '/hall-1/manage') 270 ctrl = self.browser.getControl(name='val_id') 271 ctrl.getControl(value='hall-1_A_101_D').selected = True 272 self.browser.getControl("Release selected beds", index=0).click() 273 self.assertMatches( 274 '...Successfully released beds: hall-1_A_101_D (%s)...' % self.student_id, 275 self.browser.contents) 276 self.assertMatches(bedticket.bed_coordinates, 277 u' -- booking cancelled on <YYYY-MM-DD hh:mm:ss> --') 246 278 # Remove entire hostel 247 279 self.browser.open(self.manage_container_path)
Note: See TracChangeset for help on using the changeset viewer.