Ignore:
Timestamp:
10 Nov 2011, 18:56:18 (13 years ago)
Author:
Henrik Bettermann
Message:

Much more logic for bed allocation, bed release.

Implement student relocation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7061 r7068  
    961961        self.browser.getLink("Relocate student").click()
    962962        self.assertMatches(
    963             "...Bed category hasn't changed...", self.browser.contents)
     963            "...Student can't be relocated...", self.browser.contents)
    964964        self.student.sex = u'f'
    965965        self.browser.getLink("Relocate student").click()
     
    977977        # Managers can relocate students if the bed's bed_type has changed
    978978        bed1.bed_type = u'regular_female_fr'
    979         bed2.bed_type = u'regular_male_reserved'
     979        bed2.bed_type = u'regular_male_fr'
    980980        notify(grok.ObjectModifiedEvent(bed1))
    981981        notify(grok.ObjectModifiedEvent(bed2))
    982982        self.browser.getLink("Relocate student").click()
    983983        self.assertMatches(
    984             "...Student relocated and new bed booked...", self.browser.contents)
     984            "...Student relocated...", self.browser.contents)
    985985        self.assertMatches(
    986986            "... Hall 1, Block A, Room 101, Bed A...", self.browser.contents)
    987987        self.assertMatches(bed1.owner, self.student_id)
    988988        self.assertMatches(bed2.owner, NOT_OCCUPIED)
    989         # Managers can delete bed tickets
     989        # Managers can't relocate students if bed is reserved
     990        self.student.sex = u'm'
     991        bed1.bed_type = u'regular_female_reserved'
     992        notify(grok.ObjectModifiedEvent(bed1))
     993        self.browser.getLink("Relocate student").click()
     994        self.assertMatches(
     995            "...Students in reserved beds can't be relocated...",
     996            self.browser.contents)
     997        # Managers can relocate students if booking has been cancelled but
     998        # other bed space has been manually allocated after cancellation
     999        old_owner = bed1.releaseBed()
     1000        self.assertMatches(old_owner, self.student_id)
     1001        bed2.owner = self.student_id
     1002        self.browser.open(self.acco_student_path + '/2004')
     1003        self.assertMatches(
     1004            "...booking cancelled...", self.browser.contents)
     1005        self.browser.getLink("Relocate student").click()
     1006        # We didn't informed the catalog therefore the new owner is not found
     1007        self.assertMatches(
     1008            "...There is no free bed in your category regular_male_fr...",
     1009            self.browser.contents)
     1010        # Now we fire the event properly
     1011        notify(grok.ObjectModifiedEvent(bed2))
     1012        self.browser.getLink("Relocate student").click()
     1013        self.assertMatches(
     1014            "...Student relocated...", self.browser.contents)
     1015        self.assertMatches(
     1016            "... Hall 1, Block A, Room 101, Bed B...", self.browser.contents)
     1017          # Managers can delete bed tickets
    9901018        self.browser.open(self.acco_student_path)
    9911019        ctrl = self.browser.getControl(name='val_id')
Note: See TracChangeset for help on using the changeset viewer.