Changeset 14136 for main/waeup.aaue/trunk/src/waeup/aaue/students/tests
- Timestamp:
- 27 Aug 2016, 06:52:44 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r14116 r14136 367 367 open(path, 'wb').write(self.browser.contents) 368 368 print "Sample PDF coursetickets.pdf written to %s" % path 369 370 def test_transcripts(self): 371 studylevel = createObject(u'waeup.StudentStudyLevel') 372 studylevel.level = 100 373 studylevel.level_session = 2005 374 self.student['studycourse'].entry_mode = 'ug_ft' 375 self.student['studycourse'].addStudentStudyLevel( 376 self.certificate, studylevel) 377 studylevel2 = createObject(u'waeup.StudentStudyLevel') 378 studylevel2.level = 200 379 studylevel2.level_session = 2006 380 self.student['studycourse']['100']['COURSE1'].score = 33 # no carry-over! 381 self.student['studycourse']['100']['COURSE1'].ca = 22 382 self.student['studycourse'].addStudentStudyLevel( 383 self.certificate, studylevel2) 384 # Add second course (COURSE has been added automatically) 385 courseticket = createObject('waeup.CourseTicket') 386 courseticket.code = 'ANYCODE' 387 courseticket.title = u'Any TITLE' 388 courseticket.credits = 13 389 courseticket.score = 55 390 courseticket.ca = 11 391 courseticket.semester = 1 392 courseticket.dcode = u'ANYDCODE' 393 courseticket.fcode = u'ANYFCODE' 394 self.student['studycourse']['200']['COURSE2'] = courseticket 395 self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 3.0) 396 self.assertEqual(self.student['studycourse']['200'].gpa_params_rectified[0], 4.0) 397 # Get transcript data 398 td = self.student['studycourse'].getTranscriptData() 399 self.assertEqual(td[0][0]['level_key'], '100') 400 self.assertEqual(td[0][0]['sgpa'], 3.0) 401 self.assertEqual(td[0][0]['level'].level, 100) 402 self.assertEqual(td[0][0]['level'].level_session, 2005) 403 self.assertEqual(td[0][0]['tickets_1'][0].code, 'COURSE1') 404 self.assertEqual(td[0][1]['level_key'], '200') 405 self.assertEqual(td[0][1]['sgpa'], 4.0) 406 self.assertEqual(td[0][1]['level'].level, 200) 407 self.assertEqual(td[0][1]['level'].level_session, 2006) 408 self.assertEqual(td[0][1]['tickets_1'][0].code, 'ANYCODE') 409 self.assertEqual(td[1], 3.57) 410 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 411 self.browser.open(self.student_path + '/studycourse/transcript') 412 self.assertEqual(self.browser.headers['Status'], '200 Ok') 413 self.assertTrue('Transcript' in self.browser.contents) 414 # Officers can open the pdf transcript 415 self.browser.open(self.student_path + '/studycourse/transcript.pdf') 416 self.assertEqual(self.browser.headers['Status'], '200 Ok') 417 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 418 path = os.path.join(samples_dir(), 'transcript.pdf') 419 open(path, 'wb').write(self.browser.contents) 420 print "Sample PDF transcript.pdf written to %s" % path 369 421 370 422 class StudentUITests(StudentsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.