Changeset 13047 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 15 Jun 2015, 08:57:24 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r13040 r13047 2052 2052 self.flash(_('System error: Please contact the adminsitrator.'), 2053 2053 type="danger") 2054 self.context.writeLogMessage(self, 'fatal error: %s' % bed.bed_id) 2054 self.context.writeLogMessage( 2055 self, 'fatal error: %s' % bed.bed_id) 2055 2056 return 2056 2057 else: … … 2063 2064 students_utils = getUtility(IStudentsUtils) 2064 2065 bed = students_utils.selectBed(available_beds) 2065 # Safety belt for paranoids: Does this bed really exist in portal? 2066 # Safety belt for paranoids: Does this bed really exist 2067 # in portal? 2066 2068 # XXX: Can be remove if nobody complains. 2067 2069 if bed.__parent__.__parent__ is None: 2068 self.flash(_('System error: Please contact the adminsitrator.'), 2069 type="warning") 2070 self.context.writeLogMessage(self, 'fatal error: %s' % bed.bed_id) 2070 self.flash(_( 2071 'System error: Please contact the adminsitrator.'), 2072 type="warning") 2073 self.context.writeLogMessage( 2074 self, 'fatal error: %s' % bed.bed_id) 2071 2075 return 2072 2076 bed.bookBed(student.student_id) … … 2219 2223 self.context.bed.owner = NOT_OCCUPIED 2220 2224 notify(grok.ObjectModifiedEvent(self.context.bed)) 2221 # Alocate new bed2225 # Designate new bed in ticket 2222 2226 self.context.bed_type = acc_details['bt'] 2223 2227 self.context.bed = new_bed … … 2788 2792 2789 2793 class StudentRequestPasswordPage(KofaAddFormPage): 2790 """Captcha'd re gistration page for applicants.2794 """Captcha'd request password page for students. 2791 2795 """ 2792 2796 grok.name('requestpw') -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r13046 r13047 1476 1476 '...<div>Academics Officer (view only)</div>...', 1477 1477 self.browser.contents) 1478 #self.assertMatches(1479 # '...<div>Students Officer (view only)</div>...',1480 # self.browser.contents)1481 1478 # But not his local role ... 1482 1479 self.assertFalse('Clearance Officer' in self.browser.contents) … … 1484 1481 # has changed 1485 1482 notify(LocalRoleSetEvent( 1486 self.department, 'waeup.local.ClearanceOfficer', 'mrclear', granted=True)) 1483 self.department, 'waeup.local.ClearanceOfficer', 'mrclear', 1484 granted=True)) 1487 1485 self.browser.open('http://localhost/app/users/mrclear/my_roles') 1488 1486 self.assertTrue('Clearance Officer' in self.browser.contents) … … 1525 1523 self.browser.url, self.student_path + '/reject_clearance') 1526 1524 # Type comment why 1527 self.browser.getControl(name="form.officer_comment").value = """Dear Student,1528 You did not fill properly. 1529 """ 1525 self.browser.getControl(name="form.officer_comment").value = ( 1526 'Dear Student,\n' 1527 'You did not fill properly.') 1530 1528 self.browser.getControl("Save comment").click() 1531 1529 self.assertTrue('Clearance has been annulled' in self.browser.contents) 1532 1530 url = ('http://localhost/app/students/K1000000/' 1533 1531 'contactstudent?body=Dear+Student%2C%0AYou+did+not+fill+properly.' 1534 ' %0A&subject=Clearance+has+been+annulled.')1532 '&subject=Clearance+has+been+annulled.') 1535 1533 # CO does now see the prefilled contact form and can send a message 1536 1534 self.assertEqual(self.browser.url, url) … … 1545 1543 # The comment has been stored ... 1546 1544 self.assertEqual(self.student.officer_comment, 1547 u'Dear Student,\nYou did not fill properly. \n')1545 u'Dear Student,\nYou did not fill properly.') 1548 1546 # ... and logged 1549 1547 logfile = os.path.join( … … 1553 1551 'INFO - mrclear - students.browser.StudentRejectClearancePage - ' 1554 1552 'K1000000 - comment: Dear Student,<br>You did not fill ' 1555 'properly. <br>\n' in logcontent)1553 'properly.\n' in logcontent) 1556 1554 self.browser.open(self.history_path) 1557 1555 self.assertTrue("Reset to 'clearance started' by My Public Name" in … … 1601 1599 # Additional setups according to test above 1602 1600 notify(LocalRoleSetEvent( 1603 self.department, 'waeup.local.ClearanceOfficer', 'mrclear', granted=True)) 1601 self.department, 'waeup.local.ClearanceOfficer', 'mrclear', 1602 granted=True)) 1604 1603 self.app['configuration']['2004'].clearance_enabled = True 1605 1604 IWorkflowState(self.student).setState('clearance requested') … … 2971 2970 2972 2971 def test_student_accommodation(self): 2973 # Login2974 2972 self.browser.open(self.login_path) 2975 2973 self.browser.getControl(name="form.login").value = self.student_id 2976 2974 self.browser.getControl(name="form.password").value = 'spwd' 2977 2975 self.browser.getControl("Login").click() 2978 2979 2976 # Students can add online booking fee payment tickets and open the 2980 2977 # callback view (see test_manage_payments) … … 2993 2990 parts = pin.split('-')[1:] 2994 2991 sfeseries, sfenumber = parts 2995 2996 2992 # Students can use HOS code and book a bed space with it ... 2997 2993 self.browser.open(self.acco_path) … … 3029 3025 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', 3030 3026 self.browser.contents) 3031 3032 3027 # Bed has been allocated 3033 3028 bed = self.app['hostels']['hall-1']['hall-1_A_101_A'] 3034 3029 self.assertTrue(bed.owner == self.student_id) 3035 3036 3030 # BedTicketAddPage is now blocked 3037 3031 self.browser.getLink("Book accommodation").click() 3038 3032 self.assertMatches('...You already booked a bed space...', 3039 3033 self.browser.contents) 3040 3041 3034 # The bed ticket displays the data correctly 3042 3035 self.browser.open(self.acco_path + '/2004') … … 3046 3039 self.assertMatches('...regular_male_fr...', self.browser.contents) 3047 3040 self.assertMatches('...%s...' % pin, self.browser.contents) 3048 3049 3041 # Students can open the pdf slip 3050 3042 self.browser.open(self.browser.url + '/bed_allocation_slip.pdf') 3051 3043 self.assertEqual(self.browser.headers['Status'], '200 Ok') 3052 3044 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 3053 3054 3045 # Students can't relocate themselves 3055 3046 self.assertFalse('Relocate' in self.browser.contents) … … 3057 3048 self.assertRaises( 3058 3049 Unauthorized, self.browser.open, relocate_path) 3059 3060 3050 # Students can't the Remove button and check boxes 3061 3051 self.browser.open(self.acco_path) 3062 3052 self.assertFalse('Remove' in self.browser.contents) 3063 3053 self.assertFalse('val_id' in self.browser.contents) 3064 3065 3054 # Students can pay maintenance fee now 3066 3055 self.browser.open(self.payments_path) … … 3070 3059 self.assertMatches('...Payment ticket created...', 3071 3060 self.browser.contents) 3072 3073 3061 ctrl = self.browser.getControl(name='val_id') 3074 3062 value = ctrl.options[0]
Note: See TracChangeset for help on using the changeset viewer.