Changeset 6851 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 3 Oct 2011, 11:27:15 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_batching.py
r6848 r6851 54 54 '\n')[0].split(',') 55 55 56 STUDENT_SAMPLE_DATA_UPDATE2 = open( 57 os.path.join(os.path.dirname(__file__), 'sample_student_data_update2.csv'), 58 'rb').read() 59 60 STUDENT_HEADER_FIELDS_UPDATE2 = STUDENT_SAMPLE_DATA_UPDATE2.split( 61 '\n')[0].split(',') 62 56 63 STUDENT_SAMPLE_DATA = open( 57 64 os.path.join(os.path.dirname(__file__), 'sample_student_data.csv'), … … 99 106 self.workdir = tempfile.mkdtemp() 100 107 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') 102 112 open(self.csv_file, 'wb').write(STUDENT_SAMPLE_DATA) 103 113 open(self.csv_file_update, 'wb').write(STUDENT_SAMPLE_DATA_UPDATE) 114 open(self.csv_file_update2, 'wb').write(STUDENT_SAMPLE_DATA_UPDATE2) 104 115 105 116 def tearDown(self): … … 144 155 145 156 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) 147 159 assert self.student.student_id not in self.app['students'].keys() 148 160 149 161 def test_delEntry(self): 150 162 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) 152 165 assert self.student.student_id not in self.app['students'].keys() 153 166 … … 165 178 num, num_warns, fin_file, fail_file = self.importer.doImport( 166 179 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') 167 189 self.assertEqual(num_warns,0) 168 190 shutil.rmtree(os.path.dirname(fin_file)) … … 193 215 self.workdir = tempfile.mkdtemp() 194 216 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') 196 219 open(self.csv_file, 'wb').write(STUDYCOURSE_SAMPLE_DATA) 197 220
Note: See TracChangeset for help on using the changeset viewer.