- Timestamp:
- 7 Mar 2017, 09:38:54 (8 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_level_report.py
r14528 r14608 4 4 from zope.component import getUtility 5 5 from waeup.kofa.interfaces import IJobManager 6 from waeup.kofa.students.reports.level_report import ( 7 get_students, ILevelReport) 6 from waeup.kofa.students.reports.level_report import ILevelReport 8 7 from waeup.kofa.students.tests.test_catalog import CatalogTestSetup 9 8 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 10 9 from waeup.kofa.browser.tests.test_pdf import samples_dir 11 10 12 from waeup.aaue.students.reports.level_report import CustomLevelReport 11 from waeup.aaue.students.reports.level_report import ( 12 CustomLevelReport, GradLevelReport) 13 13 14 14 from waeup.aaue.testing import FunctionalLayer … … 28 28 # we can get a table with one student 29 29 self.student['studycourse']['100']['Course1'].ca = 0 30 result = get_students('fac1', 'dep1', 'CERT1', 2010, 100) 30 lr = CustomLevelReport('fac1', 'dep1', 'CERT1', 2010, 100) 31 result = lr._get_students('fac1', 'dep1', 'CERT1', 2010, 100) 31 32 self.assertEqual(result, 32 33 [(u'1234', u'TESTER, Bob', 30, 30, '5.000', … … 45 46 print "Sample level_report.pdf written to %s" % path 46 47 return 48 49 class GradLevelReportTests(CatalogTestSetup): 50 51 layer = FunctionalLayer 52 53 def test_iface(self): 54 # ensure we fullfill interface contracts 55 obj = CustomLevelReport('fac1', 'dep1', 'CERT1', 2010, 100) 56 verifyClass(ILevelReport, GradLevelReport) 57 verifyObject(ILevelReport, obj) 58 return 59 60 def test_get_students(self): 61 62 self.student['studycourse']['100']['Course1'].ca = 0 63 lr = GradLevelReport('fac1', 'dep1', 'CERT1', 2010, 100) 64 # this is not a graduating student 65 result = lr._get_students('fac1', 'dep1', 'CERT1', 2010, 100) 66 self.assertEqual(result, []) 67 # if end level is 100, the student seems graduatiing and 68 # we can get a table with one student 69 self.certificate.end_level = 100 70 result = lr._get_students('fac1', 'dep1', 'CERT1', 2010, 100) 71 self.assertEqual(result, 72 [(u'1234', u'TESTER, Bob', 30, 30, '5.000', 73 'Nil', 'Nil', 30, 30, '5.00', '1s_st_s')]) 74 return 75 76 def test_create_pdf(self): 77 self.student['studycourse']['100']['Course1'].ca = 0 78 self.app['faculties']['fac1'].officer_1 = 'Rosa Moonshine - Dean of Faculty' 79 self.app['faculties']['fac1']['dep1'].officer_1 = 'Amalia Sunshine - Head of Department' 80 report = GradLevelReport('fac1', 'dep1', 'CERT1', 2010, 100) 81 result = report.create_pdf('JOB_ID') 82 self.assertTrue(result.startswith('%PDF-')) 83 path = os.path.join(samples_dir(), 'grad_level_report.pdf') 84 open(path, 'wb').write(result) 85 print "Sample grad_level_report.pdf written to %s" % path 86 return -
main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_raw_score_report.py
r14532 r14608 8 8 from waeup.kofa.tests.test_async import FunctionalAsyncTestCase 9 9 from waeup.kofa.browser.tests.test_pdf import samples_dir 10 from waeup.kofa.students.reports.raw_score_report import ( 11 get_students, IRawScoreReport, get_courses) 10 from waeup.kofa.students.reports.raw_score_report import IRawScoreReport 12 11 from waeup.aaue.students.reports.raw_score_report import CustomRawScoreReport 13 12 from waeup.aaue.testing import FunctionalLayer … … 36 35 def test_get_courses(self): 37 36 # we can get a list with one course code 38 result = get_courses('fac1', 'dep1', 'CERT1', 2010, 100) 37 rsr = CustomRawScoreReport('fac1', 'dep1', 'CERT1', 2010, 100) 38 result = rsr._get_courses('fac1', 'dep1', 'CERT1', 2010, 100) 39 39 self.assertEqual(result, [u'Course1']) 40 40 return … … 43 43 # we can get a table with one student 44 44 self.student['studycourse']['100']['Course1'].ca = 0 45 course_codes = get_courses('fac1', 'dep1', 'CERT1', 2010, 100) 46 result = get_students('fac1', 'dep1', 'CERT1', 2010, 100, course_codes) 45 rsr = CustomRawScoreReport('fac1', 'dep1', 'CERT1', 2010, 100) 46 course_codes = rsr._get_courses('fac1', 'dep1', 'CERT1', 2010, 100) 47 result = rsr._get_students('fac1', 'dep1', 'CERT1', 2010, 100, course_codes) 47 48 self.assertEqual(result, 48 49 [(u'1234', u'TESTER, Bob', {'Course1': (70, 'A')})]) 49 50 self.student['studycourse']['100']['Course1'].ca = None 50 result = get_students('fac1', 'dep1', 'CERT1', 2010, 100, course_codes)51 result = rsr._get_students('fac1', 'dep1', 'CERT1', 2010, 100, course_codes) 51 52 self.assertEqual(result, 52 53 [(u'1234', u'TESTER, Bob', {'Course1': ('Nil', '')})]) -
main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_session_results_presentation.py
r14528 r14608 6 6 from waeup.kofa.interfaces import IJobManager 7 7 from waeup.kofa.students.reports.session_results_presentation import ( 8 get_students,ISessionResultsPresentation)8 ISessionResultsPresentation) 9 9 from waeup.kofa.students.tests.test_catalog import CatalogTestSetup 10 10 from waeup.kofa.students.tests.test_browser import StudentsFullSetup … … 29 29 30 30 def test_get_students(self): 31 result = get_students('fac1', 'dep1', 'CERT1', 2010, 100) 31 sr = CustomSessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100) 32 result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 100) 32 33 self.assertEqual(result, 33 34 [[(u'E1000000', u'1234', u'TESTER, Bob')], [], [], [], [], [], []]) 34 35 self.student['studycourse']['100']['Course1'].score = 60 35 36 self.student['studycourse']['100']['Course1'].ca = 10 36 result = get_students('fac1', 'dep1', 'CERT1', 2010, 100)37 result = sr._get_students('fac1', 'dep1', 'CERT1', 2010, 100) 37 38 self.assertEqual(result, 38 39 [[], [], [], [], [], [(u'E1000000', u'1234', u'TESTER, Bob')], []])
Note: See TracChangeset for help on using the changeset viewer.