Ignore:
Timestamp:
7 Nov 2011, 07:43:23 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement realocation page.

File:
1 edited

Legend:

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

    r7009 r7015  
    161161        self.app['configuration'].addSessionConfiguration(configuration)
    162162
    163         # Create a hostel with bed
     163        # Create a hostel with two beds
    164164        hostel = Hostel()
    165165        hostel.hostel_id = u'hall-1'
     
    171171        bed.owner = NOT_OCCUPIED
    172172        bed.bed_type = u'regular_male_fr'
     173        self.app['hostels'][hostel.hostel_id].addBed(bed)
     174        bed = Bed()
     175        bed.bed_id = u'hall-1_A_101_B'
     176        bed.bed_number = 2
     177        bed.owner = NOT_OCCUPIED
     178        bed.bed_type = u'regular_female_fr'
    173179        self.app['hostels'][hostel.hostel_id].addBed(bed)
    174180
     
    834840        self.assertMatches('...Course registration has been started...',
    835841                           self.browser.contents)
    836         self.assertTrue(self.student.state,'school fee paid')
     842        self.assertTrue(self.student.state == 'school fee paid')
    837843        return
    838844
     
    858864        # Managers can use HOS code and book a bed space with it
    859865        self.browser.open(self.acco_student_path)
    860         self.browser.getControl("Book accommodation").click()
    861         self.assertMatches('...Wrong state...',
     866        self.browser.getLink("Book accommodation").click()
     867        self.assertMatches('...You are in the wrong...',
    862868                           self.browser.contents)
    863869        IWorkflowInfo(self.student).fireTransition('admit')
    864         self.browser.getControl("Book accommodation").click()
     870        self.browser.getLink("Book accommodation").click()
    865871        self.assertMatches('...Activation Code:...',
    866872                           self.browser.contents)
     
    872878        # Bed has been allocated
    873879        bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
    874         self.assertTrue(bed.owner,self.student_id)
     880        self.assertTrue(bed.owner == self.student_id)
    875881        # BedTicketAddPage is now blocked
    876         self.browser.getControl("Book accommodation").click()
    877         self.assertMatches('...Ticket for 2004 already created...',
     882        self.browser.getLink("Book accommodation").click()
     883        self.assertMatches('...You already booked a bed space...',
    878884            self.browser.contents)
    879885        # The bed ticket displays the data correctly
     
    884890        self.assertMatches('...regular_male_fr...', self.browser.contents)
    885891        self.assertMatches('...%s...' % pin, self.browser.contents)
    886         # Managers cab delete bed tickets
     892        # Managers can relocate students
     893        self.browser.getLink("Relocate student").click()
     894        self.assertMatches(
     895            "...Bed category hasn't changed...", self.browser.contents)
     896        self.student.sex = u'f'
     897        self.browser.getLink("Relocate student").click()
     898        self.assertMatches(
     899            "...Hall 1, Block A, Room 101, Bed B...", self.browser.contents)
     900        bed1 = self.app['hostels']['hall-1']['hall-1_A_101_A']
     901        self.assertTrue(bed1.owner == NOT_OCCUPIED)
     902        bed2 = self.app['hostels']['hall-1']['hall-1_A_101_B']
     903        self.assertTrue(bed2.owner == self.student_id)
     904        # Managers can delete bed tickets
    887905        self.browser.open(self.acco_student_path)
    888906        ctrl = self.browser.getControl(name='val_id')
Note: See TracChangeset for help on using the changeset viewer.