- Timestamp:
- 18 Jul 2015, 05:08:36 (9 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/docs/source/userdocs/hostels.rst
r13175 r13176 156 156 another bed. 157 157 158 .. _hostels_pages: 159 158 160 Browser Pages 159 161 ============= 162 163 .. seealso:: 164 165 :ref:`Manage Hostel Python Test <test_manage_hostels>` 160 166 161 167 Update Beds -
main/waeup.kofa/trunk/docs/source/userdocs/testing.rst
r13047 r13176 226 226 :pyobject: test_handle_courses_by_lecturer 227 227 228 .. _test_manage_hostels: 229 230 Manage Hostel 231 ------------- 232 233 This test can be found in 234 `waeup.kofa.hostels.tests.HostelsUITests`. The corresponding use 235 case is described :ref:`elsewhere <hostels_pages>`. 236 237 .. literalinclude:: ../../../src/waeup/kofa/hostels/tests.py 238 :pyobject: test_add_search_edit_delete_manage_hostels 228 239 229 240 .. _test_handle_accommodation: -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r13170 r13176 239 239 # Since the testbrowser does not support Javascrip the 240 240 # save action cleared the settings above and we have to set them 241 # again 241 # again. 242 242 self.assertTrue(len(hall.blocks_for_female) == 0) 243 243 hall.blocks_for_female = ['A','B'] … … 258 258 (u'hall-1_B_101_D', u'regular_female_all'), 259 259 (u'hall-1_B_101_E', u'regular_female_all')]) 260 261 # Reserve bed 260 # Reserve beds. 262 261 self.browser.getControl("Switch reservation", index=0).click() 263 262 self.assertTrue('No item selected' in self.browser.contents) … … 273 272 'hall-1_A_101_D'].bed_type, 'regular_female_reserved') 274 273 self.assertTrue('A_101_A ' in self.browser.contents) 275 # The catalog has been updated 274 # The catalog has been updated. 276 275 results = cat.searchResults( 277 276 bed_type=('regular_female_all', 'regular_female_all')) … … 289 288 (u'hall-1_A_101_C', u'regular_female_reserved'), 290 289 (u'hall-1_A_101_D', u'regular_female_reserved')]) 291 292 # Change hostel configuration with one bed booked 290 # Change hostel configuration with one bed booked. 293 291 hall['hall-1_A_101_E'].owner = u'anyid' 294 292 notify(grok.ObjectModifiedEvent(hall['hall-1_A_101_E'])) … … 298 296 expected = '...9 empty beds removed, 9 beds added, 1 occupied beds modified...' 299 297 self.assertMatches(expected,self.browser.contents) 300 # Updating beds (including booked beds!) does update catalog 298 # Updating beds (including booked beds!) does update catalog. 301 299 results = cat.searchResults( 302 300 bed_type=('regular_female_all', 'regular_female_all')) … … 304 302 self.assertEqual(results, 305 303 [(u'hall-1_B_101_D', u'regular_female_all'),]) 306 # Unreserve bed 304 # Unreserve beds. 307 305 ctrl = self.browser.getControl(name='val_id') 308 306 ctrl.getControl(value='hall-1_A_101_A').selected = True … … 314 312 'hall-1_A_101_D'].bed_type == 'regular_female_all' 315 313 self.assertFalse(expected in self.browser.contents) 316 # Release bed which has previously been booked 314 # Release bed which has previously been booked. 317 315 bedticket = BedTicket() 318 316 bedticket.booking_session = 2004 … … 332 330 self.assertMatches(bedticket.bed_coordinates, 333 331 u' -- booking cancelled on <YYYY-MM-DD hh:mm:ss> UTC --') 334 # If we release a free be, nothing will happen 332 # If we release a free be, nothing will happen. 335 333 ctrl = self.browser.getControl(name='val_id') 336 334 ctrl.getControl(value='hall-1_A_101_D').selected = True … … 338 336 self.assertMatches( 339 337 '...No allocated bed selected...', self.browser.contents) 340 # Managers can manually allocate eligible students after cancellation 338 # Managers can manually allocate eligible students after cancellation. 341 339 self.browser.open(self.container_path + '/hall-1/hall-1_A_101_A') 342 # 'not occupied' is not accepted 340 # 'not occupied' is not accepted. 343 341 self.browser.getControl("Save").click() 344 342 self.assertMatches( 345 343 "...No valid student id...", 346 344 self.browser.contents) 347 # Invalid student ids are not accepted 345 # Invalid student ids are not accepted. 348 346 self.browser.getControl(name="form.owner").value = 'nonsense' 349 347 self.browser.getControl("Save").click() … … 355 353 self.browser.getControl("Save").click() 356 354 self.assertMatches("...Form has been saved...", self.browser.contents) 357 # Students can only be allocated once 355 # Students can only be allocated once. 358 356 self.browser.open(self.container_path + '/hall-1/hall-1_A_101_B') 359 357 self.browser.getControl(name="form.owner").value = self.student_id … … 369 367 self.container_path + '/hall-1/@@manage#tab2') 370 368 # Updating the beds again will not affect the allocation and also 371 # the bed numbering remains the same 369 # the bed numbering remains the same. 372 370 old_number = self.app['hostels']['hall-1']['hall-1_A_101_A'].bed_number 373 371 old_owner = self.app['hostels']['hall-1']['hall-1_A_101_A'].owner 374 372 self.browser.getControl("Update all beds").click() 375 373 # 8 beds have been removed and re-added, 2 beds remains untouched 376 # because they are occupied 374 # because they are occupied. 377 375 expected = '...8 empty beds removed, 8 beds added, 0 occupied beds modified...' 378 376 self.assertMatches(expected,self.browser.contents) … … 382 380 self.assertEqual(new_owner, old_owner) 383 381 # If we change the bed type of an allocated bed, the modification will 384 # be indicated 382 # be indicated. 385 383 hall.blocks_for_female = ['B'] 386 384 hall.blocks_for_male = ['A'] … … 395 393 self.browser.open(self.container_path) 396 394 self.assertTrue('2 of 10' in self.browser.contents) 397 # Remove entire hostel 395 # Remove entire hostel. 398 396 self.browser.open(self.manage_container_path) 399 397 ctrl = self.browser.getControl(name='val_id') … … 402 400 self.browser.getControl("Remove selected", index=0).click() 403 401 self.assertTrue('Successfully removed' in self.browser.contents) 404 # Catalog is empty 402 # Catalog is empty. 405 403 results = cat.searchResults( 406 404 bed_type=('regular_female_all', 'regular_female_all'))
Note: See TracChangeset for help on using the changeset viewer.