Changeset 17843 for main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/tests/test_browser.py
- Timestamp:
- 13 Jul 2024, 06:40:06 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.