Ignore:
Timestamp:
21 Jan 2017, 13:45:59 (8 years ago)
Author:
Henrik Bettermann
Message:

Confine Level Reports and Session Results Presentations to certificates.

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_level_report.py

    r14392 r14423  
    1818    def test_iface(self):
    1919        # ensure we fullfill interface contracts
    20         obj = LevelReport('fac1', 'dep1', 2010, 100)
     20        obj = LevelReport('fac1', 'dep1', 'CERT1', 2010, 100)
    2121        verifyClass(ILevelReport, LevelReport)
    2222        verifyObject(ILevelReport, obj)
     
    3939        self.student['studycourse']['100']['Course3'] = ticket
    4040        # we can get a table with one student
    41         result = get_students('fac1', 'dep1', 2010, 100)
     41        result = get_students('fac1', 'dep1', 'CERT1', 2010, 100)
     42        self.assertEqual(result,
     43            [(u'1234', u'Bob Tester', 90, 30, '1.666',
     44            'm_Course2_m Course3', '', 90, 30, '1.666', '')])
     45        # same result when selecting all certificates
     46        result = get_students('fac1', 'dep1', 'all', 2010, 100)
    4247        self.assertEqual(result,
    4348            [(u'1234', u'Bob Tester', 90, 30, '1.666',
     
    7277        ticket4.credits = 30
    7378        self.student['studycourse']['100']['Course6'] = ticket4
    74         report = LevelReport('fac1', 'dep1', 2010, 100)
     79        report = LevelReport('fac1', 'dep1', 'all', 2010, 100)
    7580        result = report.create_pdf('JOB_ID')
    7681        self.assertTrue(result.startswith('%PDF-'))
     
    108113        self.browser.getControl(name="level").value = ['100']
    109114        self.browser.getControl(name="session").value = ['2010']
    110         self.browser.getControl(name="faccode_depcode").value = ['fac1_dep1']
     115        self.browser.getControl(name="faccode_depcode_certcode").value = [
     116            'fac1_dep1_CERT1']
    111117        self.browser.getControl("Create").click()
    112118        return
     
    123129                         'application/pdf')
    124130        self.assertTrue(
    125             'filename="LevelReport_fac1_dep1_2010_100_' in
     131            'filename="LevelReport_fac1_dep1_CERT1_2010_100_' in
    126132            self.browser.headers['content-disposition'])
    127133        self.assertEqual(len(self.app['reports'].running_report_jobs), 1)
     
    137143        self.assertTrue(
    138144            'INFO - zope.mgr - students.reports.level_report.LevelReportGeneratorPage - '
    139             'report %s created: Level Report (faculty=fac1, department=dep1, session=2010, level=100)'
     145            'report %s created: Level Report (faculty=fac1, department=dep1, '
     146            'certificate=CERT1, session=2010, level=100)'
    140147            % job_id in logcontent
    141148            )
    142149        self.assertTrue(
    143150            'INFO - zope.mgr - students.reports.level_report.LevelReportPDFView - '
    144             'report %s downloaded: LevelReport_fac1_dep1_2010_100_'
     151            'report %s downloaded: LevelReport_fac1_dep1_CERT1_2010_100_'
    145152            % job_id in logcontent
    146153            )
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_session_results_presentation.py

    r14410 r14423  
    2020    def test_iface(self):
    2121        # ensure we fullfill interface contracts
    22         obj = SessionResultsPresentation('fac1', 'dep1', 2010, 100)
     22        obj = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
    2323        verifyClass(ISessionResultsPresentation, SessionResultsPresentation)
    2424        verifyObject(ISessionResultsPresentation, obj)
     
    2626
    2727    def test_get_students(self):
    28         result = get_students('fac1', 'dep1', 2010, 100)
     28        result = get_students('fac1', 'dep1', 'CERT1', 2010, 100)
    2929        self.assertEqual(result,
    3030            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     
    3232
    3333    def test_get_students_at_all_levels(self):
    34         result = get_students('fac1', 'dep1', 2010, 0)
     34        result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
     35        self.assertEqual(result,
     36            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     37        return
     38
     39    def test_get_students_all_certs(self):
     40        result = get_students('fac1', 'dep1', 'all', 2010, 100)
    3541        self.assertEqual(result,
    3642            [[], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')], []])
     
    4349        studylevel.level_session = 2010
    4450        self.student['studycourse']['200'] = studylevel
    45         result = get_students('fac1', 'dep1', 2010, 0)
     51        result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
    4652        self.assertEqual(result,
    4753            [[], [], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')]])
     
    5056    def test_get_students_without_scores(self):
    5157        self.student['studycourse']['100']['Course1'].score = None
    52         result = get_students('fac1', 'dep1', 2010, 0)
     58        result = get_students('fac1', 'dep1', 'CERT1', 2010, 0)
    5359        self.assertEqual(result,
    5460            [[], [], [], [], [], [], [(u'K1000000', u'1234', u'Bob Tester')]])
     
    5662    def test_get_students_without_level_in_session(self):
    5763        self.student['studycourse']['100'].level_session = 2011
    58         result = get_students('fac1', 'dep1', 2010)
     64        result = get_students('fac1', 'dep1', 'CERT1', 2010)
    5965        self.assertEqual(result,
    6066            [[], [], [], [], [], [], []])
     
    6268
    6369    def test_create_pdf(self):
    64         report = SessionResultsPresentation('fac1', 'dep1', 2010, 100)
     70        report = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
    6571        result = report.create_pdf('JOB_ID')
    6672        self.assertTrue(result.startswith('%PDF-'))
     
    8086        self.student['studycourse']['620'] = studylevel
    8187        self.student['studycourse']['620']['Course2'] = ticket
    82         report = SessionResultsPresentation('fac1', 'dep1', 2013, 620)
     88        report = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2013, 620)
    8389        result = report.create_pdf('JOB_ID')
    8490        self.assertTrue(result.startswith('%PDF-'))
     
    101107        self.student['studycourse']['200'] = studylevel
    102108        self.student['studycourse']['200']['Course2'] = ticket
    103         report = SessionResultsPresentation('fac1', 'dep1', 2010, 0)
     109        report = SessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 0)
    104110        result = report.create_pdf('JOB_ID')
    105111        self.assertTrue(result.startswith('%PDF-'))
     
    137143        self.browser.getControl(name="level").value = [level]
    138144        self.browser.getControl(name="session").value = ['2010']
    139         self.browser.getControl(name="faccode_depcode").value = ['fac1_dep1']
     145        self.browser.getControl(name="faccode_depcode_certcode").value = ['fac1_dep1_CERT1']
    140146        self.browser.getControl("Create").click()
    141147        return
     
    152158                         'application/pdf')
    153159        self.assertTrue(
    154             'filename="SessionResultsPresentation_fac1_dep1_2010_100_' in
     160            'filename="SessionResultsPresentation_fac1_dep1_CERT1_2010_100_' in
    155161            self.browser.headers['content-disposition'])
    156162        self.assertEqual(len(self.app['reports'].running_report_jobs), 1)
     
    166172        self.assertTrue(
    167173            'INFO - zope.mgr - students.reports.session_results_presentation.SessionResultsPresentationGeneratorPage - '
    168             'report %s created: Session Results Presentation (faculty=fac1, department=dep1, session=2010, level=100)'
     174            'report %s created: Session Results Presentation '
     175            '(faculty=fac1, department=dep1, certificate=CERT1, session=2010, level=100)'
    169176            % job_id in logcontent
    170177            )
    171178        self.assertTrue(
    172179            'INFO - zope.mgr - students.reports.session_results_presentation.SessionResultsPresentationPDFView - '
    173             'report %s downloaded: SessionResultsPresentation_fac1_dep1_2010_100_'
     180            'report %s downloaded: SessionResultsPresentation_fac1_dep1_CERT1_2010_100_'
    174181            % job_id in logcontent
    175182            )
     
    192199                         'application/pdf')
    193200        self.assertTrue(
    194             'filename="SessionResultsPresentation_fac1_dep1_2010_0_' in
     201            'filename="SessionResultsPresentation_fac1_dep1_CERT1_2010_0_' in
    195202            self.browser.headers['content-disposition'])
    196203        self.assertEqual(len(self.app['reports'].running_report_jobs), 1)
     
    206213        self.assertTrue(
    207214            'INFO - zope.mgr - students.reports.session_results_presentation.SessionResultsPresentationGeneratorPage - '
    208             'report %s created: Session Results Presentation (faculty=fac1, department=dep1, session=2010, level=0)'
     215            'report %s created: Session Results Presentation '
     216            '(faculty=fac1, department=dep1, certificate=CERT1, session=2010, level=0)'
    209217            % job_id in logcontent
    210218            )
    211219        self.assertTrue(
    212220            'INFO - zope.mgr - students.reports.session_results_presentation.SessionResultsPresentationPDFView - '
    213             'report %s downloaded: SessionResultsPresentation_fac1_dep1_2010_0_'
     221            'report %s downloaded: SessionResultsPresentation_fac1_dep1_CERT1_2010_0_'
    214222            % job_id in logcontent
    215223            )
Note: See TracChangeset for help on using the changeset viewer.