- Timestamp:
- 22 Feb 2022, 12:48:36 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_student.py
r15416 r16827 160 160 super(StudentRemovalTests, self).setUp() 161 161 self.setup_for_export() 162 self.certificate2 = createObject('waeup.Certificate') 163 self.certificate2.code = 'CERT2' 164 self.certificate2.application_category = 'basic' 165 self.certificate2.start_level = 200 166 self.certificate2.end_level = 500 167 self.app['faculties']['fac1']['dep1'].certificates.addCertificate( 168 self.certificate2) 162 169 return 163 170 … … 190 197 IStudentsUtils).STUDENT_BACKUP_EXPORTER_NAMES 191 198 for name in STUDENT_BACKUP_EXPORTER_NAMES: 199 if name[-2:-1] == '_': 200 continue 192 201 csv_path = os.path.join(del_dir, '%s.csv' % name) 193 202 self.assertTrue(os.path.isfile(csv_path)) … … 218 227 IStudentsUtils).STUDENT_BACKUP_EXPORTER_NAMES 219 228 for name in STUDENT_BACKUP_EXPORTER_NAMES: 229 if name[-2:-1] == '_': 230 continue 220 231 csv_path = os.path.join(del_dir, '%s.csv' % name) 221 232 self.assertTrue(os.path.isfile(csv_path)) … … 223 234 # We expect 3 lines output including a linebreak at end of file. 224 235 self.assertEqual(len(contents), 3) 236 return 237 238 def test_backup_single_graduated_transferred_data(self): 239 del_dir = self.app['datacenter'].graduated_path 240 # when a single graduated student is removed, the data is backed up 241 # somewhere else including previous study courses 242 self.setup_student(self.student) 243 error = self.student.transfer(self.certificate2, current_session=2013) 244 self.assertTrue(error == None) 245 IWorkflowState(self.student).setState('graduated') 246 handle_student_removed(self.student, None) 247 # The previous study course data were put into CSV files 248 name = 'studentstudycourses_1' 249 csv_path = os.path.join(del_dir, '%s.csv' % name) 250 self.assertTrue(os.path.isfile(csv_path)) 251 contents = open(csv_path, 'rb').read().split('\r\n') 252 # We expect 3 lines output including a linebreak at end of file. 253 self.assertEqual(len(contents), 3) 254 name = 'studentstudycourses_2' 255 csv_path = os.path.join(del_dir, '%s.csv' % name) 256 self.assertTrue(os.path.isfile(csv_path)) 257 contents = open(csv_path, 'rb').read().split('\r\n') 258 # We expect only 2 lines output including a linebreak at end of file. 259 self.assertEqual(len(contents), 2) 260 name = 'studentstudylevels_1' 261 csv_path = os.path.join(del_dir, '%s.csv' % name) 262 self.assertTrue(os.path.isfile(csv_path)) 263 contents = open(csv_path, 'rb').read().split('\r\n') 264 # We expect 3 lines output including a linebreak at end of file. 265 self.assertEqual(len(contents), 3) 266 name = 'coursetickets_1' 267 csv_path = os.path.join(del_dir, '%s.csv' % name) 268 self.assertTrue(os.path.isfile(csv_path)) 269 contents = open(csv_path, 'rb').read().split('\r\n') 270 # We expect 3 lines output including a linebreak at end of file. 271 self.assertEqual(len(contents), 3) 225 272 return 226 273
Note: See TracChangeset for help on using the changeset viewer.