Changeset 9403 for main


Ignore:
Timestamp:
24 Oct 2012, 06:37:08 (12 years ago)
Author:
Henrik Bettermann
Message:

Students book accommodation without AC. Bed is randomly selected.

Location:
main/waeup.futminna/trunk/src/waeup/futminna/students
Files:
1 added
3 edited

Legend:

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

    r8912 r9403  
    1919from zope.i18n import translate
    2020from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
     21from waeup.kofa.students.browser import BedTicketAddPage
    2122from kofacustom.nigeria.students.browser import (
    2223    NigeriaOnlinePaymentDisplayFormPage,
    2324    NigeriaOnlinePaymentAddFormPage,
    2425    NigeriaExportPDFPaymentSlipPage)
     26from waeup.kofa.interfaces import MessageFactory as _
    2527
    2628from waeup.futminna.students.interfaces import ICustomStudentOnlinePayment
     
    4951    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    5052    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     53
     54class CustomBedTicketAddPage(BedTicketAddPage):
     55    """ Page to add an online payment ticket
     56    """
     57    grok.template('bookbed')
     58    buttonname = _('Create bed ticket')
     59    notice = ''
     60    with_ac = False
  • main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py

    r9402 r9403  
    3232    IExtFileStore, IFileStoreNameChooser)
    3333from waeup.kofa.students.interfaces import IStudentsUtils
     34from waeup.kofa.hostels.hostel import Bed, NOT_OCCUPIED
    3435from waeup.futminna.testing import FunctionalLayer
    3536
     
    9293        self.student['studycourse'].current_verdict = 'A'
    9394        self.student['studycourse'].current_level = 100
     95        # Add sse bed
     96        bed = Bed()
     97        bed.bed_id = u'hall-1_A_101_C'
     98        bed.bed_number = 2
     99        bed.owner = NOT_OCCUPIED
     100        bed.bed_type = u'sse_male_fr'
     101        self.app['hostels']['hall-1'].addBed(bed)
    94102
    95103    def test_get_returning_data(self):
     
    162170        details = utils.getAccommodationDetails(self.student)
    163171        self.assertEqual(details['bt'], u'sse_male_fr')
     172
     173    def test_student_accommodation(self):
     174        # Login
     175        self.browser.open(self.login_path)
     176        self.browser.getControl(name="form.login").value = self.student_id
     177        self.browser.getControl(name="form.password").value = 'spwd'
     178        self.browser.getControl("Login").click()
     179
     180        # Students can book accommodation without AC ...
     181        self.browser.open(self.acco_path)
     182        IWorkflowState(self.student).setState('admitted')
     183        self.browser.getLink("Book accommodation").click()
     184        self.assertFalse('Activation Code:' in self.browser.contents)
     185        self.browser.getControl("Create bed ticket").click()
     186        # Bed is randomly selected but, since there is only
     187        # one bed for this student, we know that
     188        self.assertMatches('...Hall 1, Block A, Room 101, Bed C...',
     189                           self.browser.contents)
     190        return
  • main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py

    r9402 r9403  
    1717##
    1818import grok
     19import random
    1920from time import time
    2021from zope.component import createObject
     
    2829
    2930    """
     31
     32    def selectBed(self, available_beds):
     33        """Randomly select a bed from a list of available beds.
     34
     35        """
     36        return random.choice(available_beds)
    3037
    3138    def getReturningData(self, student):
Note: See TracChangeset for help on using the changeset viewer.