Ignore:
Timestamp:
16 Nov 2015, 09:05:30 (9 years ago)
Author:
Henrik Bettermann
Message:

Add option which allows students to select a desired hostel before booking accommodation.

File:
1 edited

Legend:

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

    r13455 r13457  
    12031203        # Managers can use HOS code and book a bed space with it
    12041204        self.browser.open(self.acco_path)
    1205         self.browser.getLink("Book accommodation").click()
     1205        self.browser.getControl("Book accommodation").click()
    12061206        self.assertMatches('...You are in the wrong...',
    12071207                           self.browser.contents)
     
    12101210        # are in accommodation session
    12111211        self.student['studycourse'].current_session = 2003
    1212         self.browser.getLink("Book accommodation").click()
     1212        self.browser.getControl("Book accommodation").click()
    12131213        self.assertMatches('...Your current session does not match...',
    12141214                           self.browser.contents)
    12151215        self.student['studycourse'].current_session = 2004
    12161216        # All requirements are met and ticket can be created
    1217         self.browser.getLink("Book accommodation").click()
     1217        self.browser.getControl("Book accommodation").click()
    12181218        self.assertMatches('...Activation Code:...',
    12191219                           self.browser.contents)
     
    12271227        self.assertTrue(bed1.owner == self.student_id)
    12281228        # BedTicketAddPage is now blocked
    1229         self.browser.getLink("Book accommodation").click()
     1229        self.browser.getControl("Book accommodation").click()
    12301230        self.assertMatches('...You already booked a bed space...',
    12311231            self.browser.contents)
     
    30083008
    30093009    def test_student_accommodation(self):
     3010        # Create a second hostel with one bed
     3011        hostel = Hostel()
     3012        hostel.hostel_id = u'hall-2'
     3013        hostel.hostel_name = u'Hall 2'
     3014        self.app['hostels'].addHostel(hostel)
     3015        bed = Bed()
     3016        bed.bed_id = u'hall-2_A_101_A'
     3017        bed.bed_number = 1
     3018        bed.owner = NOT_OCCUPIED
     3019        bed.bed_type = u'regular_female_fr'
     3020        self.app['hostels'][hostel.hostel_id].addBed(bed)
     3021
    30103022        self.browser.open(self.login_path)
    30113023        self.browser.getControl(name="form.login").value = self.student_id
     
    30323044        # ... but not if booking period has expired ...
    30333045        self.app['hostels'].enddate = datetime.now(pytz.utc)
    3034         self.browser.getLink("Book accommodation").click()
     3046        self.browser.getControl("Book accommodation").click()
    30353047        self.assertMatches('...Outside booking period: ...',
    30363048                           self.browser.contents)
     
    30383050        # ... or student data are incomplete ...
    30393051        self.student['studycourse'].current_level = None
    3040         self.browser.getLink("Book accommodation").click()
     3052        self.browser.getControl("Book accommodation").click()
    30413053        self.assertMatches('...Your data are incomplete...',
    30423054            self.browser.contents)
    30433055        self.student['studycourse'].current_level = 100
    30443056        # ... or student is not the an allowed state ...
    3045         self.browser.getLink("Book accommodation").click()
     3057        self.browser.getControl("Book accommodation").click()
    30463058        self.assertMatches('...You are in the wrong...',
    30473059                           self.browser.contents)
     3060        # Students can still not see the disired hostel selector.
     3061        self.assertFalse('desired hostel' in self.browser.contents)
    30483062        IWorkflowInfo(self.student).fireTransition('admit')
    3049         self.browser.getLink("Book accommodation").click()
     3063        # Students can now see the disired hostel selector.
     3064        self.browser.reload()
     3065        self.browser.open(self.acco_path)
     3066        self.assertTrue('desired hostel' in self.browser.contents)
     3067        self.browser.getControl(name="hostel").value = ['hall-2']
     3068        self.browser.getControl("Save").click()
     3069        self.assertTrue('selection has been saved' in self.browser.contents)
     3070        self.assertTrue('<option selected="selected" value="hall-2">'
     3071            in self.browser.contents)
     3072        self.browser.getControl("Book accommodation").click()
    30503073        self.assertMatches('...Activation Code:...',
    30513074                           self.browser.contents)
     
    30583081        # ... or ACs owned by somebody else.
    30593082        ac.owner = u'Anybody'
     3083        self.browser.getControl(name="ac_series").value = sfeseries
     3084        self.browser.getControl(name="ac_number").value = sfenumber
     3085        self.browser.getControl("Create bed ticket").click()
     3086        # Hostel 2 has only a bed for women.
     3087        self.assertTrue('There is no free bed in your desired hostel'
     3088            in self.browser.contents)
     3089        self.browser.getControl(name="hostel").value = ['hall-1']
     3090        self.browser.getControl("Save").click()
     3091        self.browser.getControl("Book accommodation").click()
     3092        # Student can't use faked ACs ...
    30603093        self.browser.getControl(name="ac_series").value = sfeseries
    30613094        self.browser.getControl(name="ac_number").value = sfenumber
     
    30753108        self.assertTrue(bed.owner == self.student_id)
    30763109        # BedTicketAddPage is now blocked.
    3077         self.browser.getLink("Book accommodation").click()
     3110        self.browser.getControl("Book accommodation").click()
    30783111        self.assertMatches('...You already booked a bed space...',
    30793112            self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.