Changeset 12845 for main/waeup.uniben/trunk/src/waeup/uniben/students/tests
- Timestamp:
- 2 Apr 2015, 10:51:44 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r12566 r12845 839 839 self.browser.open(self.student_path + '/clear') 840 840 self.assertTrue('Student has been cleared' in self.browser.contents) 841 842 def test_transcripts(self): 843 studylevel = createObject(u'waeup.StudentStudyLevel') 844 studylevel.level = 100 845 studylevel.level_session = 2005 846 self.student['studycourse'].entry_mode = 'ug_ft' 847 self.student['studycourse'].addStudentStudyLevel( 848 self.certificate, studylevel) 849 studylevel2 = createObject(u'waeup.StudentStudyLevel') 850 studylevel2.level = 110 851 studylevel2.level_session = 2006 852 self.student['studycourse'].addStudentStudyLevel( 853 self.certificate, studylevel2) 854 # Add second course (COURSE has been added automatically) 855 courseticket = createObject('waeup.CourseTicket') 856 courseticket.code = 'ANYCODE' 857 courseticket.title = u'Any TITLE' 858 courseticket.credits = 13 859 courseticket.score = 66 860 courseticket.semester = 1 861 courseticket.dcode = u'ANYDCODE' 862 courseticket.fcode = u'ANYFCODE' 863 self.student['studycourse']['110']['COURSE2'] = courseticket 864 self.student['studycourse']['100']['COURSE1'].score = 55 865 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 3.0) 866 self.assertEqual(self.student['studycourse']['110'].gpa_params_rectified[0], 4.0) 867 # Get transcript data 868 td = self.student['studycourse'].getTranscriptData() 869 self.assertEqual(td[0][0]['level_key'], '100') 870 self.assertEqual(td[0][0]['sgpa'], 3.0) 871 self.assertEqual(td[0][0]['level'].level, 100) 872 self.assertEqual(td[0][0]['level'].level_session, 2005) 873 self.assertEqual(td[0][0]['tickets_1'][0].code, 'COURSE1') 874 self.assertEqual(td[0][1]['level_key'], '110') 875 self.assertEqual(td[0][1]['sgpa'], 4.0) 876 self.assertEqual(td[0][1]['level'].level, 110) 877 self.assertEqual(td[0][1]['level'].level_session, 2006) 878 self.assertEqual(td[0][1]['tickets_1'][0].code, 'ANYCODE') 879 self.assertEqual(td[1], 3.57) 880 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 881 self.browser.open(self.student_path + '/studycourse/transcript') 882 self.assertEqual(self.browser.headers['Status'], '200 Ok') 883 self.assertTrue('Transcript' in self.browser.contents) 884 # Officers can open the pdf transcript 885 self.browser.open(self.student_path + '/studycourse/transcript.pdf') 886 self.assertEqual(self.browser.headers['Status'], '200 Ok') 887 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 888 path = os.path.join(samples_dir(), 'transcript.pdf') 889 open(path, 'wb').write(self.browser.contents) 890 print "Sample PDF transcript.pdf written to %s" % path
Note: See TracChangeset for help on using the changeset viewer.