- Timestamp:
- 15 Mar 2017, 12:08:35 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_session_results_presentation.py
r14608 r14631 12 12 from waeup.kofa.browser.tests.test_pdf import samples_dir 13 13 14 from waeup.aaue.students.reports.session_results_presentation import CustomSessionResultsPresentation 14 from waeup.aaue.students.reports.session_results_presentation import ( 15 CustomSessionResultsPresentation, 16 GradSessionResultsPresentation, 17 IGradSessionResultsPresentation) 15 18 16 19 from waeup.aaue.testing import FunctionalLayer … … 40 43 return 41 44 42 43 45 def test_create_pdf(self): 44 46 self.certificate.degree = 'BA(FS)' … … 55 57 56 58 59 class GradSessionResultsPresentationTests(CatalogTestSetup): 60 61 layer = FunctionalLayer 62 63 def test_iface(self): 64 # ensure we fullfill interface contracts 65 obj = GradSessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100) 66 verifyClass(IGradSessionResultsPresentation, GradSessionResultsPresentation) 67 verifyObject(IGradSessionResultsPresentation, obj) 68 return 69 70 def test_get_students(self): 71 sr = GradSessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100) 72 result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 100) 73 self.assertEqual(result, [[], [], [], [], [], [], []]) 74 # if end level is 100, the student seems graduating and 75 # we can get a table with one student 76 self.certificate.end_level = 100 77 self.student['studycourse']['100']['Course1'].credits = 91 78 result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 100) 79 self.assertEqual(result, [[], [], [], [], [], [], []]) 80 self.student['studycourse']['100']['Course1'].score = 60 81 self.student['studycourse']['100']['Course1'].ca = 10 82 result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 100) 83 self.assertEqual(result, 84 [[], [], [], [], [], [(u'E1000000', u'1234', u'TESTER, Bob')], []]) 85 return 86 87 def test_create_pdf(self): 88 self.certificate.degree = 'BA(FS)' 89 self.certificate.end_level = 100 90 self.student['studycourse']['100']['Course1'].credits = 91 91 self.student['studycourse']['100']['Course1'].ca = 0 92 self.app['faculties']['fac1'].officer_1 = 'Rosa Moonshine - Dean of Faculty' 93 self.app['faculties']['fac1']['dep1'].officer_1 = 'Amalia Sunshine - Head of Department' 94 self.app['faculties']['fac1']['dep1'].officer_2 = 'Theresa Starbright - External Examiner' 95 report = GradSessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100) 96 result = report.create_pdf('JOB_ID') 97 self.assertTrue(result.startswith('%PDF-')) 98 path = os.path.join(samples_dir(), 'grad_session_results_presentation.pdf') 99 open(path, 'wb').write(result) 100 print "Sample grad_session_results_presentation.pdf written to %s" % path 101 return 102
Note: See TracChangeset for help on using the changeset viewer.