Ignore:
Timestamp:
18 Jul 2015, 05:08:36 (9 years ago)
Author:
Henrik Bettermann
Message:

Include Python test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py

    r13170 r13176  
    239239        # Since the testbrowser does not support Javascrip the
    240240        # save action cleared the settings above and we have to set them
    241         # again
     241        # again.
    242242        self.assertTrue(len(hall.blocks_for_female) == 0)
    243243        hall.blocks_for_female = ['A','B']
     
    258258             (u'hall-1_B_101_D', u'regular_female_all'),
    259259             (u'hall-1_B_101_E', u'regular_female_all')])
    260 
    261         # Reserve bed
     260        # Reserve beds.
    262261        self.browser.getControl("Switch reservation", index=0).click()
    263262        self.assertTrue('No item selected' in self.browser.contents)
     
    273272            'hall-1_A_101_D'].bed_type, 'regular_female_reserved')
    274273        self.assertTrue('A_101_A  ' in self.browser.contents)
    275         # The catalog has been updated
     274        # The catalog has been updated.
    276275        results = cat.searchResults(
    277276            bed_type=('regular_female_all', 'regular_female_all'))
     
    289288             (u'hall-1_A_101_C', u'regular_female_reserved'),
    290289             (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.
    293291        hall['hall-1_A_101_E'].owner = u'anyid'
    294292        notify(grok.ObjectModifiedEvent(hall['hall-1_A_101_E']))
     
    298296        expected = '...9 empty beds removed, 9 beds added, 1 occupied beds modified...'
    299297        self.assertMatches(expected,self.browser.contents)
    300         # Updating beds (including booked beds!) does update catalog
     298        # Updating beds (including booked beds!) does update catalog.
    301299        results = cat.searchResults(
    302300            bed_type=('regular_female_all', 'regular_female_all'))
     
    304302        self.assertEqual(results,
    305303            [(u'hall-1_B_101_D', u'regular_female_all'),])
    306         # Unreserve bed
     304        # Unreserve beds.
    307305        ctrl = self.browser.getControl(name='val_id')
    308306        ctrl.getControl(value='hall-1_A_101_A').selected = True
     
    314312            'hall-1_A_101_D'].bed_type == 'regular_female_all'
    315313        self.assertFalse(expected in self.browser.contents)
    316         # Release bed which has previously been booked
     314        # Release bed which has previously been booked.
    317315        bedticket = BedTicket()
    318316        bedticket.booking_session = 2004
     
    332330        self.assertMatches(bedticket.bed_coordinates,
    333331          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.
    335333        ctrl = self.browser.getControl(name='val_id')
    336334        ctrl.getControl(value='hall-1_A_101_D').selected = True
     
    338336        self.assertMatches(
    339337          '...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.
    341339        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.
    343341        self.browser.getControl("Save").click()
    344342        self.assertMatches(
    345343            "...No valid student id...",
    346344            self.browser.contents)
    347         # Invalid student ids are not accepted
     345        # Invalid student ids are not accepted.
    348346        self.browser.getControl(name="form.owner").value = 'nonsense'
    349347        self.browser.getControl("Save").click()
     
    355353        self.browser.getControl("Save").click()
    356354        self.assertMatches("...Form has been saved...", self.browser.contents)
    357         # Students can only be allocated once
     355        # Students can only be allocated once.
    358356        self.browser.open(self.container_path + '/hall-1/hall-1_A_101_B')
    359357        self.browser.getControl(name="form.owner").value = self.student_id
     
    369367            self.container_path + '/hall-1/@@manage#tab2')
    370368        # 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.
    372370        old_number = self.app['hostels']['hall-1']['hall-1_A_101_A'].bed_number
    373371        old_owner = self.app['hostels']['hall-1']['hall-1_A_101_A'].owner
    374372        self.browser.getControl("Update all beds").click()
    375373        # 8 beds have been removed and re-added, 2 beds remains untouched
    376         # because they are occupied
     374        # because they are occupied.
    377375        expected = '...8 empty beds removed, 8 beds added, 0 occupied beds modified...'
    378376        self.assertMatches(expected,self.browser.contents)
     
    382380        self.assertEqual(new_owner, old_owner)
    383381        # If we change the bed type of an allocated bed, the modification will
    384         # be indicated
     382        # be indicated.
    385383        hall.blocks_for_female = ['B']
    386384        hall.blocks_for_male = ['A']
     
    395393        self.browser.open(self.container_path)
    396394        self.assertTrue('2 of 10' in self.browser.contents)
    397         # Remove entire hostel
     395        # Remove entire hostel.
    398396        self.browser.open(self.manage_container_path)
    399397        ctrl = self.browser.getControl(name='val_id')
     
    402400        self.browser.getControl("Remove selected", index=0).click()
    403401        self.assertTrue('Successfully removed' in self.browser.contents)
    404         # Catalog is empty
     402        # Catalog is empty.
    405403        results = cat.searchResults(
    406404            bed_type=('regular_female_all', 'regular_female_all'))
Note: See TracChangeset for help on using the changeset viewer.