Ignore:
Timestamp:
1 May 2015, 14:32:09 (9 years ago)
Author:
Henrik Bettermann
Message:

Filter students by current level in reports.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_payment_statistics.py

    r12564 r12897  
    2222        # ensure we fullfill interface contracts
    2323        obj = StudentPaymentStatisticsReport(
    24             2010, 'Undergraduate Full-Time', 'faccode')
     24            2010, 'Undergraduate Full-Time', 0, 'faccode')
    2525        verifyClass(IStudentPaymentStatisticsReport, StudentPaymentStatisticsReport)
    2626        verifyObject(IStudentPaymentStatisticsReport, obj)
     
    2929    def test_get_student_payment_stats_session_simple(self):
    3030        # we can get a table with one student
    31         result1 = get_student_payment_stats(2010, 'Undergraduate Full-Time', 'faccode')
    32         result2 = get_student_payment_stats(2009, 'Undergraduate Full-Time', 'faccode')
     31        result1 = get_student_payment_stats(
     32            2010, 'Undergraduate Full-Time', 0, 'faccode')
     33        result2 = get_student_payment_stats(
     34            2009, 'Undergraduate Full-Time', 0, 'faccode')
    3335        self.assertEqual(
    3436            result1,
     
    5355    def test_create_pdf(self):
    5456        report = StudentPaymentStatisticsReport(
    55             2010, 'Undergraduate Full-Time', 'faccode')
     57            2010, 'Undergraduate Full-Time', 0,  'faccode')
    5658        result = report.create_pdf()
    5759        self.assertTrue(result.startswith('%PDF-'))
     
    104106                         'application/pdf')
    105107        self.assertTrue(
    106             'filename="StudentPaymentStatisticsReport_2004_2005_All_' in
     108            'filename="StudentPaymentStatisticsReport_2004_2005_All__' in
    107109            self.browser.headers['content-disposition'])
    108110        self.assertEqual(len(self.app['reports'].running_report_jobs), 1)
     
    118120        self.assertTrue(
    119121            'INFO - zope.mgr - students.reports.student_payment_statistics.StudentPaymentStatisticsReportGeneratorPage - '
    120             'report %s created: Student Payment Statistics (session=2004, mode=All, breakdown=depcode)'
     122            'report %s created: Student Payment Statistics (session=2004, mode=All, level=0, breakdown=depcode)'
    121123            % job_id in logcontent
    122124            )
    123125        self.assertTrue(
    124126            'INFO - zope.mgr - students.reports.student_payment_statistics.StudentPaymentStatisticsReportPDFView - '
    125             'report %s downloaded: StudentPaymentStatisticsReport_2004_2005_All_'
     127            'report %s downloaded: StudentPaymentStatisticsReport_2004_2005_All__'
    126128            % job_id in logcontent
    127129            )
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_statistics.py

    r12619 r12897  
    2525        # ensure we fullfill interface contracts
    2626        obj = StudentStatisticsReport(
    27             2010, 'Undergraduate Full-Time', 'faccode')
     27            2010, 'Undergraduate Full-Time', 0, 'faccode')
    2828        verifyClass(IStudentStatisticsReport, StudentStatisticsReport)
    2929        verifyObject(IStudentStatisticsReport, obj)
     
    3232    def test_get_student_stats_session_simple(self):
    3333        # we can get a table with one student
    34         result1 = get_student_stats(2010, 'Undergraduate Full-Time', 'faccode')
    35         result2 = get_student_stats(2009, 'Undergraduate Full-Time', 'faccode')
     34        result1 = get_student_stats(
     35            2010, 'Undergraduate Full-Time', 0, 'faccode')
     36        result2 = get_student_stats(
     37            2009, 'Undergraduate Full-Time', 0, 'faccode')
    3638        self.assertEqual(
    3739            result1,
     
    5153        # we can get a table with several students
    5254        self.create_cert(u'fac2', u'dep2', u'CERT2')
    53         result1 = get_student_stats(2010, 'Undergraduate Full-Time', 'faccode')
    54         result2 = get_student_stats(2009, 'Undergraduate Full-Time', 'faccode')
     55        result1 = get_student_stats(
     56            2010, 'Undergraduate Full-Time', 0, 'faccode')
     57        result2 = get_student_stats(
     58            2009, 'Undergraduate Full-Time', 0, 'faccode')
    5559        self.assertEqual(
    5660            result1,
     
    7276        # we can get a table with several students
    7377        self.create_cert(u'fac2', u'dep2', u'CERT2')
    74         result1 = get_student_stats(2010, 'Undergraduate Full-Time', 'depcode')
    75         result2 = get_student_stats(2009, 'Undergraduate Full-Time', 'depcode')
     78        result1 = get_student_stats(2010, 'Undergraduate Full-Time', 0, 'depcode')
     79        result2 = get_student_stats(2009, 'Undergraduate Full-Time', 0, 'depcode')
     80        self.assertEqual(
     81            result1,
     82            ((u'fac1/dep1', u'fac2/dep2', u'Total'),
     83             self.states,
     84             ((1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1),
     85              (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
     86              (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1),)))
     87        self.assertEqual(
     88            result2,
     89            ((u'fac1/dep1', u'fac2/dep2', u'Total'),
     90             self.states,
     91             ((0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
     92              (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
     93              (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),)))
     94        return
     95
     96    def test_get_student_stats_session_multiple_dep_breakdown_level_100(self):
     97        # we can get a table with several students
     98        self.create_cert(u'fac2', u'dep2', u'CERT2')
     99        result1 = get_student_stats(2010, 'Undergraduate Full-Time', 0, 'depcode')
     100        result2 = get_student_stats(2009, 'Undergraduate Full-Time', 0, 'depcode')
    76101        self.assertEqual(
    77102            result1,
     
    93118        self.create_cert(u'FAC2', u'dept2', u'CERT2')
    94119        report = StudentStatisticsReport(
    95             2010, 'Undergraduate Full-Time', 'faccode')
     120            2010, 'Undergraduate Full-Time', 0, 'faccode')
    96121        result = report.create_pdf()
    97122        self.assertTrue(result.startswith('%PDF-'))
     
    99124        open(path, 'wb').write(result)
    100125        print "Sample PDF student_statistics.pdf written to %s" % path
     126        return
     127
     128    def test_create_100level_pdf(self):
     129        self.create_cert(u'FAC2', u'dept2', u'CERT2')
     130        report = StudentStatisticsReport(
     131            2010, 'Undergraduate Full-Time', 100, 'faccode')
     132        result = report.create_pdf()
     133        self.assertTrue(result.startswith('%PDF-'))
     134        path = os.path.join(samples_dir(), 'student_statistics_100.pdf')
     135        open(path, 'wb').write(result)
     136        print "Sample PDF student_statistics_100.pdf written to %s" % path
    101137        return
    102138
     
    158194        self.assertTrue(
    159195            'INFO - zope.mgr - students.reports.student_statistics.StudentStatisticsReportGeneratorPage - '
    160             'report %s created: Student Statistics (session=2004, mode=All, breakdown=depcode)'
     196            'report %s created: Student Statistics (session=2004, mode=All, level=0, breakdown=depcode)'
    161197            % job_id in logcontent
    162198            )
    163199        self.assertTrue(
    164200            'INFO - zope.mgr - students.reports.student_statistics.StudentStatisticsReportPDFView - '
    165             'report %s downloaded: StudentStatisticsReport_2004_2005_All_'
     201            'report %s downloaded: StudentStatisticsReport_2004_2005_All__'
    166202            % job_id in logcontent
    167203            )
Note: See TracChangeset for help on using the changeset viewer.