Changeset 13176 for main


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

Include Python test.

Location:
main/waeup.kofa/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/docs/source/userdocs/hostels.rst

    r13175 r13176  
    156156another bed.
    157157
     158.. _hostels_pages:
     159
    158160Browser Pages
    159161=============
     162
     163.. seealso::
     164
     165   :ref:`Manage Hostel Python Test <test_manage_hostels>`
    160166
    161167Update Beds
  • main/waeup.kofa/trunk/docs/source/userdocs/testing.rst

    r13047 r13176  
    226226   :pyobject: test_handle_courses_by_lecturer
    227227
     228.. _test_manage_hostels:
     229
     230Manage Hostel
     231-------------
     232
     233This test can be found in
     234`waeup.kofa.hostels.tests.HostelsUITests`. The corresponding use
     235case is described :ref:`elsewhere <hostels_pages>`.
     236
     237.. literalinclude:: ../../../src/waeup/kofa/hostels/tests.py
     238   :pyobject: test_add_search_edit_delete_manage_hostels
    228239
    229240.. _test_handle_accommodation:
  • 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&nbsp;&nbsp;' 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.