Changeset 7061


Ignore:
Timestamp:
9 Nov 2011, 15:26:49 (13 years ago)
Author:
Henrik Bettermann
Message:

An existing HOS code can only be used if students' current session is equal to accommodation session.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
2 edited

Legend:

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

    r7060 r7061  
    12361236            self.redirect(self.url(self.context))
    12371237            return
    1238         if str(grok.getSite()[
    1239                 'configuration'].accommodation_session) in self.context.keys():
     1238        if student['studycourse'].current_session != acc_details['booking_session']:
     1239            self.flash(
     1240                'Your current session does not match accommodation session.')
     1241            self.redirect(self.url(self.context))
     1242            return
     1243        if str(acc_details['booking_session']) in self.context.keys():
    12401244            self.flash('You already booked a bed space in current accommodation session.')
    12411245            self.redirect(self.url(self.context))
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7060 r7061  
    132132        parts = self.existing_clrpin.split('-')[1:]
    133133        self.existing_clrseries, self.existing_clrnumber = parts
     134        # Create 2 access codes with prefix 'HOS'
     135        pin_container.createBatch(
     136            datetime.now(), 'some_userid', 'HOS', 9.99, 2)
     137        pins = pin_container['HOS-1'].values()
     138        self.existing_hosac = pins[0]
     139        self.existing_hospin = pins[0].representation
     140        parts = self.existing_hospin.split('-')[1:]
     141        self.existing_hosseries, self.existing_hosnumber = parts
    134142
    135143        # Populate university
     
    920928                           self.browser.contents)
    921929        IWorkflowInfo(self.student).fireTransition('admit')
     930        # An existing HOS code can only be used if students
     931        # are in accommodation session
     932        self.student['studycourse'].current_session = 2003
     933        self.browser.getLink("Book accommodation").click()
     934        self.assertMatches('...Your current session does not match...',
     935                           self.browser.contents)
     936        self.student['studycourse'].current_session = 2004
     937        # All requirements are met and ticket can be created
    922938        self.browser.getLink("Book accommodation").click()
    923939        self.assertMatches('...Activation Code:...',
Note: See TracChangeset for help on using the changeset viewer.