- Timestamp:
- 9 May 2023, 15:19:08 (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/tests/test_browser.py
r16695 r17406 68 68 open(path, 'wb').write(self.browser.contents) 69 69 print "Sample PDF UG admission_slip.pdf written to %s" % path 70 71 def test_transcripts(self): 72 studylevel = createObject(u'waeup.StudentStudyLevel') 73 studylevel.level = 100 74 studylevel.level_session = 2005 75 self.student['studycourse'].entry_mode = 'ug_ft' 76 self.student['studycourse'].addStudentStudyLevel( 77 self.certificate, studylevel) 78 studylevel2 = createObject(u'waeup.StudentStudyLevel') 79 studylevel2.level = 110 80 studylevel2.level_session = 2006 81 self.student['studycourse'].addStudentStudyLevel( 82 self.certificate, studylevel2) 83 # Add second course (COURSE has been added automatically) 84 courseticket = createObject('waeup.CourseTicket') 85 courseticket.code = 'ANYCODE' 86 courseticket.title = u'Any TITLE' 87 courseticket.credits = 13 88 courseticket.score = 66 89 courseticket.semester = 1 90 courseticket.attempted_number = 4 91 courseticket.dcode = u'ANYDCODE' 92 courseticket.fcode = u'ANYFCODE' 93 self.student['studycourse']['110']['COURSE2'] = courseticket 94 self.student['studycourse']['100']['COURSE1'].score = 55 95 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 2.5) 96 self.assertEqual(self.student['studycourse']['110'].gpa_params_rectified[0], 3.0) 97 # Get transcript data 98 td = self.student['studycourse'].getTranscriptData() 99 self.assertEqual(td[0][0]['level_key'], '100') 100 self.assertEqual(td[0][0]['sgpa'], 2.5) 101 self.assertEqual(td[0][0]['level'].level, 100) 102 self.assertEqual(td[0][0]['level'].level_session, 2005) 103 self.assertEqual(td[0][0]['tickets_1'][0].code, 'COURSE1') 104 self.assertEqual(td[0][1]['level_key'], '110') 105 self.assertEqual(td[0][1]['sgpa'], 3.0) 106 self.assertEqual(td[0][1]['level'].level, 110) 107 self.assertEqual(td[0][1]['level'].level_session, 2006) 108 self.assertEqual(td[0][1]['tickets_1'][0].code, 'ANYCODE') 109 self.assertEqual(td[1], 2.782608695652174) 110 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 111 self.browser.open(self.student_path + '/studycourse/transcript') 112 self.assertEqual(self.browser.headers['Status'], '200 Ok') 113 self.assertTrue('Transcript' in self.browser.contents) 114 # Officers can open the pdf transcript 115 self.browser.open(self.student_path + '/studycourse/transcript.pdf') 116 self.assertEqual(self.browser.headers['Status'], '200 Ok') 117 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 118 path = os.path.join(samples_dir(), 'transcript.pdf') 119 open(path, 'wb').write(self.browser.contents) 120 print "Sample PDF transcript.pdf written to %s" % path 70 121
Note: See TracChangeset for help on using the changeset viewer.