Ignore:
Timestamp:
22 Feb 2022, 22:08:37 (3 years ago)
Author:
Henrik Bettermann
Message:

Add importers for previous study course data.

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

Legend:

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

    r16821 r16828  
    3939    StudentProcessor, StudentStudyCourseProcessor,
    4040    StudentStudyLevelProcessor, CourseTicketProcessor,
    41     StudentOnlinePaymentProcessor, StudentVerdictProcessor)
     41    StudentOnlinePaymentProcessor, StudentVerdictProcessor,
     42    FirstStudentStudyCourseProcessor,
     43    FirstStudentStudyLevelProcessor,
     44    FirstCourseTicketProcessor)
    4245from waeup.kofa.students.payments import StudentOnlinePayment
    4346from waeup.kofa.students.student import Student
     
    733736        self.assertEqual(self.student['studycourse'].certificate.code, 'CERT2')
    734737        self.assertEqual(self.student['studycourse_1'].certificate.code, 'CERT1')
    735         self.assertEqual(self.student['studycourse'].entry_mode, 'transfer')
     738        self.assertEqual(self.student['studycourse'].entry_mode, 'transferred')
    736739        self.assertEqual(self.student['studycourse_1'].entry_mode, 'ug_ft')
    737740        self.assertEqual(self.student.current_mode, 'ug_pt')
     
    745748            'INFO - system - '
    746749            'StudentStudyCourse Processor (update only) - '
    747             'sample_transfer_data - K1000000 - updated: entry_mode=transfer, '
     750            'sample_transfer_data - K1000000 - updated: entry_mode=transferred, '
    748751            'certificate=CERT2, current_session=2009, current_level=300'
    749752            in logcontent)
     
    11351138            '1,COURSE1,<IGNORE>,300,Cannot remove: no such entry\r\n'
    11361139            )
     1140        shutil.rmtree(os.path.dirname(fin_file))
     1141
     1142    def test_import_firstcourse_with_content(self):
     1143        processor = FirstStudentStudyCourseProcessor()
     1144        csv_file = os.path.join(
     1145            self.workdir, 'sample_studycourse_data.csv')
     1146        num, num_warns, fin_file, fail_file = processor.doImport(
     1147            csv_file, STUDYCOURSE_HEADER_FIELDS,'create')
     1148        self.assertEqual(num_warns,1)
     1149        content = open(fail_file).read()
     1150        self.assertTrue('current_level: not in range' in content)
     1151        studycourse = processor.getEntry(dict(reg_number='1'), self.app)
     1152        self.assertEqual(studycourse.certificate.code, u'CERT1')
     1153        self.assertEqual(studycourse.__name__, u'studycourse_1')
     1154        cat = queryUtility(ICatalog, name='students_catalog')
     1155        results = list(cat.searchResults(reg_number=('1', '1')))
     1156        self.assertEqual([i for i in results[0].keys()],
     1157            [u'accommodation', u'payments', u'studycourse', u'studycourse_1'])
     1158        processor = FirstStudentStudyLevelProcessor()
     1159        csv_file = os.path.join(
     1160            self.workdir, 'sample_studylevel_data.csv')
     1161        num, num_warns, fin_file, fail_file = processor.doImport(
     1162            csv_file, STUDYLEVEL_HEADER_FIELDS,'create')
     1163        self.assertEqual(num_warns,3)
     1164        assert processor.entryExists(
     1165            dict(reg_number='1', level='100'), self.app) is True
     1166        studylevel = processor.getEntry(
     1167            dict(reg_number='1', level='100'), self.app)
     1168        self.assertEqual(studylevel.__parent__.certificate.code, u'CERT1')
     1169        self.assertEqual(studylevel.level_session, 2008)
     1170        self.assertEqual(studylevel.level_verdict, '0')
     1171        self.assertEqual(studylevel.level, 100)
     1172        self.assertEqual([i for i in results[0]['studycourse_1'].keys()],
     1173            [u'100', u'200'])
     1174        processor = FirstCourseTicketProcessor()
     1175        csv_file = os.path.join(
     1176            self.workdir, 'sample_courseticket_data.csv')
     1177        num, num_warns, fin_file, fail_file = processor.doImport(
     1178            csv_file, COURSETICKET_HEADER_FIELDS,'create')
     1179        assert processor.entryExists(
     1180            dict(reg_number='1', level='100', code='COURSE1'), self.app) is True
     1181        self.assertEqual([i for i in results[0]['studycourse_1']['100'].keys()],
     1182            [u'COURSE1'])
    11371183        shutil.rmtree(os.path.dirname(fin_file))
    11381184
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r16662 r16828  
    16501650        modeselect = self.browser.getControl(name='mode')
    16511651        importerselect.getControl(
    1652             'StudentStudyCourse Processor (update only)').selected = True
     1652            'StudentStudyCourse Processor (update only)',index=0).selected = True
    16531653        modeselect.getControl(value='create').selected = True
    16541654        self.browser.getControl('Proceed to step 3').click()
Note: See TracChangeset for help on using the changeset viewer.