Ignore:
Timestamp:
12 Jun 2012, 09:58:03 (13 years ago)
Author:
Henrik Bettermann
Message:

Check if booking perios is expired before allocating a bed.

To do: The update method of BedTicketAddPage? is too long and code has to be split and moved to data models.

File:
1 edited

Legend:

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

    r8685 r8688  
    2121import shutil
    2222import tempfile
     23import pytz
     24from datetime import datetime, timedelta
    2325from StringIO import StringIO
    24 from datetime import datetime
    2526import os
    2627import grok
     
    171172            self.course, level=100)
    172173
    173         # Configure university
     174        # Configure university and hostels
    174175        self.app['hostels'].accommodation_states = ['admitted']
    175176        self.app['hostels'].accommodation_session = 2004
     177        delta = timedelta(days=10)
     178        self.app['hostels'].startdate = datetime.now(pytz.utc) - delta
     179        self.app['hostels'].enddate = datetime.now(pytz.utc) + delta
    176180        self.app['configuration'].carry_over = True
    177181        configuration = createObject('waeup.SessionConfiguration')
     
    17491753        sfeseries, sfenumber = parts
    17501754
    1751         # Students can use HOS code and book a bed space with it
     1755        # Students can use HOS code and book a bed space with it ...
    17521756        self.browser.open(self.acco_path)
     1757        # ... but not if booking period has expired ...
     1758        self.app['hostels'].enddate = datetime.now(pytz.utc)
     1759        self.browser.getLink("Book accommodation").click()
     1760        self.assertMatches('...Outside booking period: ...',
     1761                           self.browser.contents)
     1762        self.app['hostels'].enddate = datetime.now(pytz.utc) + timedelta(days=10)
     1763        # ... or student is not the an allowed state ...
    17531764        self.browser.getLink("Book accommodation").click()
    17541765        self.assertMatches('...You are in the wrong...',
     
    17581769        self.assertMatches('...Activation Code:...',
    17591770                           self.browser.contents)
     1771        # Student can't used faked ACs ...
    17601772        self.browser.getControl(name="ac_series").value = u'nonsense'
    17611773        self.browser.getControl(name="ac_number").value = sfenumber
     
    17631775        self.assertMatches('...Activation code is invalid...',
    17641776                           self.browser.contents)
     1777        # ... or ACs owned by somebody else.
    17651778        ac.owner = u'Anybody'
    17661779        self.browser.getControl(name="ac_series").value = sfeseries
Note: See TracChangeset for help on using the changeset viewer.