Changeset 9423 for main/waeup.kofa/trunk/src
- Timestamp:
- 26 Oct 2012, 07:55:45 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r9416 r9423 291 291 # Release bed which has previously been booked 292 292 bedticket = BedTicket() 293 bedticket. ticket_id = u'2004'293 bedticket.booking_session = 2004 294 294 bedticket.bed_coordinates = u'anything' 295 295 self.student['accommodation'].addBedTicket(bedticket) -
main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py
r9243 r9423 606 606 ) 607 607 608 maint_fee = schema.Float( 609 title = _(u'Rent'), 610 default = 0.0, 611 required = False, 612 ) 613 608 614 def getSessionString(): 609 615 """Returns the session string from the vocabulary. -
main/waeup.kofa/trunk/src/waeup/kofa/students/accommodation.py
r8736 r9423 30 30 31 31 class StudentAccommodation(grok.Container): 32 """This is a container for accommodation objects.32 """This is a container for bed tickets. 33 33 """ 34 34 grok.implements(IStudentAccommodation, IStudentNavigation) … … 45 45 raise TypeError( 46 46 'StudentAccommodation containers contain only IBedTicket instances') 47 self[ bedticket.ticket_id] = bedticket47 self[str(bedticket.booking_session)] = bedticket 48 48 return 49 49 -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9422 r9423 1339 1339 self.redirect(self.url(self.context)) 1340 1340 return 1341 if 'maintenance' in p_category: 1342 current_session = str(student['studycourse'].current_session) 1343 if not student['accommodation'].has_key(current_session): 1344 self.flash(_('You have not yet booked a bed.')) 1345 self.redirect(self.url(self.context)) 1346 return 1341 1347 students_utils = getUtility(IStudentsUtils) 1342 1348 error, payment = students_utils.setPaymentDetails( … … 1627 1633 bedticket.bed_coordinates = translate( 1628 1634 bc, 'waeup.kofa',target_language=portal_language) 1629 key = str(acc_details['booking_session']) 1630 self.context[key] = bedticket 1635 self.context.addBedTicket(bedticket) 1631 1636 self.context.writeLogMessage(self, 'booked: %s' % bed.bed_id) 1632 1637 self.flash(_('Bed ticket created and bed booked: ${a}', -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r9420 r9423 590 590 """ 591 591 592 def addBedTicket(bedticket): 593 """Add a bed ticket object. 594 """ 595 596 592 597 class IBedTicket(IKofaObject): 593 598 """A ticket for accommodation booking. … … 598 603 bed_coordinates = schema.TextLine( 599 604 title = _(u'Bed Coordinates'), 600 required = False,605 required = True, 601 606 readonly = False, 602 607 ) … … 604 609 bed_type = schema.TextLine( 605 610 title = _(u'Bed Type'), 606 required = False,611 required = True, 607 612 readonly = False, 608 613 ) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9420 r9423 186 186 configuration.clearance_fee = 3456.0 187 187 configuration.booking_fee = 123.4 188 configuration.maint_fee = 987.0 188 189 self.app['configuration'].addSessionConfiguration(configuration) 189 190 … … 1889 1890 self.browser.contents) 1890 1891 1891 def test_student_ payments(self):1892 def test_student_clearance_payment(self): 1892 1893 # Login 1893 1894 self.browser.open(self.login_path) … … 1965 1966 self.browser.contents) 1966 1967 1968 def test_student_schoolfee_payment(self): 1969 # Login 1970 self.browser.open(self.login_path) 1971 self.browser.getControl(name="form.login").value = self.student_id 1972 self.browser.getControl(name="form.password").value = 'spwd' 1973 self.browser.getControl("Login").click() 1974 1967 1975 # Students can add online school fee payment tickets. 1968 1976 IWorkflowState(self.student).setState('returning') 1969 1977 self.browser.open(self.payments_path) 1978 self.assertRaises( 1979 LookupError, self.browser.getControl, name='val_id') 1970 1980 self.browser.getControl("Add online payment ticket").click() 1971 1981 self.browser.getControl(name="form.p_category").value = ['schoolfee'] … … 1997 2007 self.assertMatches('...Payment approved...', 1998 2008 self.browser.contents) 1999 2000 # Students can remove only online payment tickets which have2001 # not received a valid callback2002 self.browser.open(self.payments_path)2003 self.assertRaises(2004 LookupError, self.browser.getControl, name='val_id')2005 self.browser.open(self.payments_path + '/addop')2006 self.browser.getControl(name="form.p_category").value = ['bed_allocation']2007 self.browser.getControl("Create ticket").click()2008 self.browser.open(self.payments_path)2009 ctrl = self.browser.getControl(name='val_id')2010 value = ctrl.options[0]2011 ctrl.getControl(value=value).selected = True2012 self.browser.getControl("Remove selected", index=0).click()2013 self.assertTrue('Successfully removed' in self.browser.contents)2014 2009 2015 2010 # The new SFE-0 pin can be used for starting new session … … 2026 2021 self.assertTrue(self.student.state == 'school fee paid') 2027 2022 return 2023 2024 def test_student_bedallocation_payment(self): 2025 # Login 2026 self.browser.open(self.login_path) 2027 self.browser.getControl(name="form.login").value = self.student_id 2028 self.browser.getControl(name="form.password").value = 'spwd' 2029 self.browser.getControl("Login").click() 2030 self.browser.open(self.payments_path) 2031 self.browser.open(self.payments_path + '/addop') 2032 self.browser.getControl(name="form.p_category").value = ['bed_allocation'] 2033 self.browser.getControl("Create ticket").click() 2034 self.assertMatches('...ticket created...', 2035 self.browser.contents) 2036 # Students can remove only online payment tickets which have 2037 # not received a valid callback 2038 self.browser.open(self.payments_path) 2039 ctrl = self.browser.getControl(name='val_id') 2040 value = ctrl.options[0] 2041 ctrl.getControl(value=value).selected = True 2042 self.browser.getControl("Remove selected", index=0).click() 2043 self.assertTrue('Successfully removed' in self.browser.contents) 2044 2045 def test_student_maintenance_payment(self): 2046 # Login 2047 self.browser.open(self.login_path) 2048 self.browser.getControl(name="form.login").value = self.student_id 2049 self.browser.getControl(name="form.password").value = 'spwd' 2050 self.browser.getControl("Login").click() 2051 self.browser.open(self.payments_path) 2052 self.browser.open(self.payments_path + '/addop') 2053 self.browser.getControl(name="form.p_category").value = ['hostel_maintenance'] 2054 self.browser.getControl("Create ticket").click() 2055 self.assertMatches('...You have not yet booked a bed...', 2056 self.browser.contents) 2057 # We continue this test in test_student_accommodation 2028 2058 2029 2059 def test_student_previous_payments(self): … … 2285 2315 self.assertFalse('Remove' in self.browser.contents) 2286 2316 self.assertFalse('val_id' in self.browser.contents) 2317 2318 # Students can pay maintenance fee now 2319 self.browser.open(self.payments_path) 2320 self.browser.open(self.payments_path + '/addop') 2321 self.browser.getControl(name="form.p_category").value = ['hostel_maintenance'] 2322 self.browser.getControl("Create ticket").click() 2323 self.assertMatches('...Payment ticket created...', 2324 self.browser.contents) 2287 2325 return 2288 2326 -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r9219 r9423 360 360 p_item = self.getAccommodationDetails(student)['bt'] 361 361 amount = academic_session.booking_fee 362 elif category == 'hostel_maintenance': 363 amount = academic_session.maint_fee 362 364 if amount in (0.0, None): 363 365 return _('Amount could not be determined.' +
Note: See TracChangeset for help on using the changeset viewer.