Changeset 17843
- Timestamp:
- 13 Jul 2024, 06:40:06 (5 months ago)
- Location:
- main/kofacustom.unidel/trunk/src/kofacustom/unidel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.unidel/trunk/src/kofacustom/unidel/ftesting.zcml
r17300 r17843 53 53 principal="zope.Anybody" 54 54 /> 55 55 <grant 56 permission="waeup.Authenticated" 57 principal="zope.Authenticated" /> 56 58 57 59 <principal -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py
r17832 r17843 35 35 StudentTriggerTransitionFormPage, 36 36 ExportPDFAdmissionSlip, 37 ExportAttendanceSlip, 37 38 PaymentsManageFormPage, msave, emit_lock_message) 38 39 from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket, IStudentBase … … 302 303 note=self.note) 303 304 304 class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip): 305 grok.require('waeup.managePortal') 306 305 306 class CustomExportAttendanceSlip(ExportAttendanceSlip): 307 """ 308 """ 309 310 #def _signatures(self): 311 # return ([_('Student Signature')], 312 # [_('Clearance Officer Signature')]) 313 314 @property 315 def note(self): 316 return """ 317 318 319 Faculty: __________________________________________________________ 320 321 Department: ______________________________________________________ 322 323 Date of Examination: _______________________________________________ 324 325 Time of Examination: _______________________________________________ 326 327 Venue of Examination: ______________________________________________ 328 329 Names of Supervisors: 330 331 ______________________________________________ 332 333 ______________________________________________ 334 335 ______________________________________________ 336 337 ______________________________________________ 338 339 ______________________________________________ 340 """ 341 342 def render(self): 343 lecturers = [i['user_title'] for i in self.getUsersWithLocalRoles() 344 if i['local_role'] == 'waeup.local.Lecturer'] 345 lecturers = ', '.join(lecturers) 346 students_utils = getUtility(IStudentsUtils) 347 return students_utils.renderPDFCourseticketsOverview( 348 self, 'attendance', self.current_academic_session, 349 self.data(self.current_academic_session), 350 lecturers, '', 65, self.note) -
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/tests/test_browser.py
r17715 r17843 34 34 from waeup.kofa.interfaces import ( 35 35 IExtFileStore, IFileStoreNameChooser) 36 from waeup.kofa.interfaces import IUserAccount, IJobManager, VALIDATED, CREATED 36 37 from waeup.kofa.browser.tests.test_pdf import samples_dir 37 38 from waeup.kofa.students.interfaces import IStudentsUtils 39 from waeup.kofa.tests.test_authentication import SECRET 38 40 from kofacustom.unidel.testing import FunctionalLayer 39 41 … … 68 70 open(path, 'wb').write(self.browser.contents) 69 71 print "Sample exampclearance_slip.pdf written to %s" % path 72 73 class LecturerUITests(StudentsFullSetup): 74 75 layer = FunctionalLayer 76 77 def login_as_lecturer(self): 78 self.app['users'].addUser('mrslecturer', SECRET) 79 self.app['users']['mrslecturer'].email = 'mrslecturer@foo.ng' 80 self.app['users']['mrslecturer'].title = u'Mercedes Benz' 81 # Add course ticket 82 self.studylevel = createObject(u'waeup.StudentStudyLevel') 83 self.studylevel.level = 100 84 self.studylevel.level_session = 2004 85 self.student['studycourse'].addStudentStudyLevel( 86 self.certificate, self.studylevel) 87 # Assign local Lecturer role for a course. 88 course = self.app['faculties']['fac1']['dep1'].courses['COURSE1'] 89 prmlocal = IPrincipalRoleManager(course) 90 prmlocal.assignRoleToPrincipal('waeup.local.Lecturer', 'mrslecturer') 91 notify(LocalRoleSetEvent( 92 course, 'waeup.local.Lecturer', 'mrslecturer', granted=True)) 93 # Login as lecturer. 94 self.browser.open(self.login_path) 95 self.browser.getControl(name="form.login").value = 'mrslecturer' 96 self.browser.getControl( 97 name="form.password").value = SECRET 98 self.browser.getControl("Login").click() 99 # Store reused urls/paths 100 self.course_url = ( 101 'http://localhost/app/faculties/fac1/dep1/courses/COURSE1') 102 self.edit_scores_url = '%s/edit_scores' % self.course_url 103 # Set standard parameters 104 self.app['configuration'].current_academic_session = 2004 105 self.app['faculties']['fac1']['dep1'].score_editing_disabled = False 106 IWorkflowState(self.student).setState(VALIDATED) 107 108 def test_lecturers_can_download_attendance_sheet(self): 109 # A course ticket slip can be downloaded 110 self.course.title = (u'Lorem ipsum dolor sit amet, consectetur adipisici, ' 111 u'sed eiusmod tempor incidunt ut labore et dolore') 112 self.student.firstname = u'Emmanuella Woyengifigha Mercy Onosemudiana' 113 self.student.lastname = u'OYAKEMIEGBEGHA' 114 self.student.matric_number = u'CMS/FBM/NSG/17/38186' 115 self.login_as_lecturer() 116 pdf_url = '%s/attendance.pdf' % self.course_url 117 self.browser.open(pdf_url) 118 self.assertEqual(self.browser.headers['Status'], '200 Ok') 119 self.assertEqual( 120 self.browser.headers['Content-Type'], 'application/pdf') 121 path = os.path.join(samples_dir(), 'attendance.pdf') 122 open(path, 'wb').write(self.browser.contents) 123 print "Sample PDF attendance.pdf written to %s" % path
Note: See TracChangeset for help on using the changeset viewer.