Ignore:
Timestamp:
3 Oct 2011, 11:27:15 (13 years ago)
Author:
Henrik Bettermann
Message:

Add second student data update test with matric_numbers as locators.

File:
1 edited

Legend:

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

    r6848 r6851  
    5454    '\n')[0].split(',')
    5555
     56STUDENT_SAMPLE_DATA_UPDATE2 = open(
     57    os.path.join(os.path.dirname(__file__), 'sample_student_data_update2.csv'),
     58    'rb').read()
     59
     60STUDENT_HEADER_FIELDS_UPDATE2 = STUDENT_SAMPLE_DATA_UPDATE2.split(
     61    '\n')[0].split(',')
     62
    5663STUDENT_SAMPLE_DATA = open(
    5764    os.path.join(os.path.dirname(__file__), 'sample_student_data.csv'),
     
    99106        self.workdir = tempfile.mkdtemp()
    100107        self.csv_file = os.path.join(self.workdir, 'sample_student_data.csv')
    101         self.csv_file_update = os.path.join(self.workdir, 'sample_student_data_update.csv')
     108        self.csv_file_update = os.path.join(
     109            self.workdir, 'sample_student_data_update.csv')
     110        self.csv_file_update2 = os.path.join(
     111            self.workdir, 'sample_student_data_update2.csv')
    102112        open(self.csv_file, 'wb').write(STUDENT_SAMPLE_DATA)
    103113        open(self.csv_file_update, 'wb').write(STUDENT_SAMPLE_DATA_UPDATE)
     114        open(self.csv_file_update2, 'wb').write(STUDENT_SAMPLE_DATA_UPDATE2)
    104115
    105116    def tearDown(self):
     
    144155
    145156    def test_delEntry(self):
    146         self.importer.delEntry(dict(student_id=self.student.student_id), self.app)
     157        self.importer.delEntry(
     158            dict(student_id=self.student.student_id), self.app)
    147159        assert self.student.student_id not in self.app['students'].keys()
    148160
    149161    def test_delEntry(self):
    150162        assert self.student.student_id in self.app['students'].keys()
    151         self.importer.delEntry(dict(reg_number=self.student.reg_number), self.app)
     163        self.importer.delEntry(
     164            dict(reg_number=self.student.reg_number), self.app)
    152165        assert self.student.student_id not in self.app['students'].keys()
    153166
     
    165178        num, num_warns, fin_file, fail_file = self.importer.doImport(
    166179            self.csv_file_update, STUDENT_HEADER_FIELDS_UPDATE, 'update')
     180        self.assertEqual(num_warns,0)
     181        shutil.rmtree(os.path.dirname(fin_file))
     182
     183    def test_import_update2(self):
     184        num, num_warns, fin_file, fail_file = self.importer.doImport(
     185            self.csv_file, STUDENT_HEADER_FIELDS)
     186        shutil.rmtree(os.path.dirname(fin_file))
     187        num, num_warns, fin_file, fail_file = self.importer.doImport(
     188            self.csv_file_update2, STUDENT_HEADER_FIELDS_UPDATE2, 'update')
    167189        self.assertEqual(num_warns,0)
    168190        shutil.rmtree(os.path.dirname(fin_file))
     
    193215        self.workdir = tempfile.mkdtemp()
    194216        self.importer = StudentStudyCourseProcessor()
    195         self.csv_file = os.path.join(self.workdir, 'sample_studycourse_data.csv')
     217        self.csv_file = os.path.join(
     218            self.workdir, 'sample_studycourse_data.csv')
    196219        open(self.csv_file, 'wb').write(STUDYCOURSE_SAMPLE_DATA)
    197220
Note: See TracChangeset for help on using the changeset viewer.