Ignore:
Timestamp:
7 Mar 2017, 09:38:54 (8 years ago)
Author:
Henrik Bettermann
Message:

Add 'Graduating Students Summary of Results' report and adjust to changes in base package.

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  
    44from zope.component import getUtility
    55from waeup.kofa.interfaces import IJobManager
    6 from waeup.kofa.students.reports.level_report import (
    7     get_students, ILevelReport)
     6from waeup.kofa.students.reports.level_report import ILevelReport
    87from waeup.kofa.students.tests.test_catalog import CatalogTestSetup
    98from waeup.kofa.students.tests.test_browser import StudentsFullSetup
    109from waeup.kofa.browser.tests.test_pdf import samples_dir
    1110
    12 from waeup.aaue.students.reports.level_report import CustomLevelReport
     11from waeup.aaue.students.reports.level_report import (
     12    CustomLevelReport, GradLevelReport)
    1313
    1414from waeup.aaue.testing import FunctionalLayer
     
    2828        # we can get a table with one student
    2929        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)
    3132        self.assertEqual(result,
    3233            [(u'1234', u'TESTER, Bob', 30, 30, '5.000',
     
    4546        print "Sample level_report.pdf written to %s" % path
    4647        return
     48
     49class 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  
    88from waeup.kofa.tests.test_async import FunctionalAsyncTestCase
    99from 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)
     10from waeup.kofa.students.reports.raw_score_report import IRawScoreReport
    1211from waeup.aaue.students.reports.raw_score_report import CustomRawScoreReport
    1312from waeup.aaue.testing import FunctionalLayer
     
    3635    def test_get_courses(self):
    3736        # 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)
    3939        self.assertEqual(result, [u'Course1'])
    4040        return
     
    4343        # we can get a table with one student
    4444        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)
    4748        self.assertEqual(result,
    4849            [(u'1234', u'TESTER, Bob', {'Course1': (70, 'A')})])
    4950        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)
    5152        self.assertEqual(result,
    5253            [(u'1234', u'TESTER, Bob', {'Course1': ('Nil', '')})])
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_session_results_presentation.py

    r14528 r14608  
    66from waeup.kofa.interfaces import IJobManager
    77from waeup.kofa.students.reports.session_results_presentation import (
    8     get_students, ISessionResultsPresentation)
     8    ISessionResultsPresentation)
    99from waeup.kofa.students.tests.test_catalog import CatalogTestSetup
    1010from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    2929
    3030    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)
    3233        self.assertEqual(result,
    3334            [[(u'E1000000', u'1234', u'TESTER, Bob')], [], [], [], [], [], []])
    3435        self.student['studycourse']['100']['Course1'].score = 60
    3536        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)
    3738        self.assertEqual(result,
    3839            [[], [], [], [], [], [(u'E1000000', u'1234', u'TESTER, Bob')], []])
Note: See TracChangeset for help on using the changeset viewer.