Changeset 13353


Ignore:
Timestamp:
27 Oct 2015, 08:03:37 (9 years ago)
Author:
Henrik Bettermann
Message:

Customize getBedCoordinates.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students
Files:
3 edited

Legend:

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

    r13351 r13353  
    3232    ExportPDFTranscriptSlip,
    3333    ExportPDFAdmissionSlip,
     34    BedTicketAddPage,
    3435    )
    3536from kofacustom.nigeria.students.browser import (
     
    317318            self.context.student, omit_fields=self.omit_fields,
    318319            pre_text=pre_text, post_text='')
     320
     321class CustomBedTicketAddPage(BedTicketAddPage):
     322    """ Page to add an online payment ticket
     323    """
     324    with_ac = False
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13351 r13353  
    527527        self.assertMatches('...<h1 class="kofa-content-label">Start clearance</h1>...',
    528528                   self.browser.contents)
     529
     530    def test_student_accommodation(self):
     531        del self.student['accommodation']['2004']
     532        # Login
     533        self.browser.open(self.login_path)
     534        self.browser.getControl(name="form.login").value = self.student_id
     535        self.browser.getControl(name="form.password").value = 'spwd'
     536        self.browser.getControl("Login").click()
     537        # Students can book accommodation without AC ...
     538        self.browser.open(self.acco_path)
     539        IWorkflowInfo(self.student).fireTransition('admit')
     540        self.browser.getLink("Book accommodation").click()
     541        self.assertFalse('Activation Code:' in self.browser.contents)
     542        self.browser.getControl("Create bed ticket").click()
     543        # Bed is randomly selected but, since there is only
     544        # one bed for this student, we know that
     545        self.assertEqual(self.student['accommodation']['2004'].bed_coordinates,
     546            'Hall 1, Block A, Room 101, Bed A (regular_male_fr)')
     547        # Only the hall name is displayed
     548        self.assertEqual(self.student['accommodation']['2004'].display_coordinates,
     549            'Hall 1')
     550        self.assertFalse('Hall 1, Block A, Room 101, Bed A'
     551            in self.browser.contents)
     552        self.assertTrue('<td>Hall 1</td>'
     553            in self.browser.contents)
     554        return
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r13348 r13353  
    197197        return 48
    198198
     199    def getBedCoordinates(self, bedticket):
     200        """Return descriptive bed coordinates.
     201        This method can be used to customize the `display_coordinates`
     202        property method in order to  display a
     203        customary description of the bed space.
     204        """
     205        bc = bedticket.bed_coordinates.split(',')
     206        if len(bc) == 4:
     207            return bc[0]
     208        return bedticket.bed_coordinates
     209
    199210    # AAUE prefix
    200211    STUDENT_ID_PREFIX = u'E'
Note: See TracChangeset for help on using the changeset viewer.