Changeset 9283
- Timestamp:
- 3 Oct 2012, 21:36:14 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_batching.py
r9271 r9283 94 94 clearSite() 95 95 shutil.rmtree(self.dc_root) 96 shutil.rmtree(self.workdir) 96 97 97 98 class ACBatchProcessorTest(ACFullSetup): … … 126 127 self.csv_file = os.path.join(self.workdir, 'sample_batch_data.csv') 127 128 open(self.csv_file, 'wb').write(BATCH_SAMPLE_DATA) 128 self.processor.doImport(self.csv_file, BATCH_HEADER_FIELDS) 129 num, num_warns, fin_file, fail_file = self.processor.doImport( 130 self.csv_file, BATCH_HEADER_FIELDS) 131 shutil.rmtree(os.path.dirname(fin_file)) 129 132 130 133 self.processor = AccessCodeProcessor() … … 175 178 self.csv_file = os.path.join(self.workdir, 'sample_batch_data.csv') 176 179 open(self.csv_file, 'wb').write(BATCH_SAMPLE_DATA) 177 self.processor.doImport(self.csv_file, BATCH_HEADER_FIELDS) 180 num, num_warns, fin_file, fail_file = self.processor.doImport( 181 self.csv_file, BATCH_HEADER_FIELDS) 182 shutil.rmtree(os.path.dirname(fin_file)) 178 183 179 184 self.processor = AccessCodeProcessor() … … 182 187 num, num_warns, fin_file, fail_file = self.processor.doImport( 183 188 self.csv_file, AC_HEADER_FIELDS) 189 shutil.rmtree(os.path.dirname(fin_file)) 184 190 185 191 self.assertEqual(self.app['accesscodes']['HOS-1'].used_num, 1) … … 192 198 num, num_warns, fin_file, fail_file = self.processor.doImport( 193 199 self.csv_file, AC_HEADER_FIELDS_UPDATE, 'update') 194 fin_file = open(fin_file).read()195 200 self.assertEqual(num_warns,0) 196 201 self.assertEqual( … … 216 221 self.assertEqual(self.app['accesscodes']['CLR-1'].used_num, 1) 217 222 self.assertEqual(self.app['accesscodes']['CLR-1'].disabled_num, 0) 223 shutil.rmtree(os.path.dirname(fin_file)) 218 224 return -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r9202 r9283 434 434 return 435 435 436 def tearDown(self): 437 super(ExportTests, self).tearDown() 438 clearSite() 439 shutil.rmtree(os.path.dirname(self.outfile)) 440 436 441 class HostelProcessorTest(HostelsFullSetup): 437 442 … … 441 446 self.processor = HostelProcessor() 442 447 self.workdir = tempfile.mkdtemp() 443 self.csv_file = os.path.join(self.workdir, 'sample_ student_data.csv')448 self.csv_file = os.path.join(self.workdir, 'sample_hostel_data.csv') 444 449 open(self.csv_file, 'wb').write(HOSTEL_SAMPLE_DATA) 445 450 num, num_warns, fin_file, fail_file = self.processor.doImport( … … 462 467 in logcontent) 463 468 shutil.rmtree(os.path.dirname(fin_file)) 464 return 469 shutil.rmtree(self.workdir) 470 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r9282 r9283 576 576 class StudentVerdictProcessorTest(StudentImportExportSetup): 577 577 578 579 578 def setUp(self): 580 579 super(StudentVerdictProcessorTest, self).setUp() -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9273 r9283 1336 1336 self.student['studycourse'].current_level = 999 1337 1337 IWorkflowState(self.student).setState('school fee paid') 1338 self.certificate.study_mode = 'pg_ft'1339 1338 self.browser.open(self.login_path) 1340 1339 self.browser.getControl(name="form.login").value = self.student_id -
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_imagestorage.py
r7811 r9283 274 274 def test_default_handler_create_file(self): 275 275 # we can use the default handler to store files 276 fs = ExtFileStore( )276 fs = ExtFileStore(root=self.workdir) 277 277 result = fs.createFile('sample.txt', StringIO('sample text')) 278 278 self.assertEqual(result.data, 'sample.txt') … … 282 282 def test_default_handler_get_file(self): 283 283 # we can get files stored by the default handler 284 fs = ExtFileStore( )284 fs = ExtFileStore(root=self.workdir) 285 285 fs.createFile('sample.txt', StringIO('sample text')) 286 286 result1 = fs.getFile('sample.txt') … … 292 292 def test_customized_handler_create_file(self): 293 293 # we can use registered filename handlers 294 fs = ExtFileStore( )294 fs = ExtFileStore(root=self.workdir) 295 295 result = fs.createFile( 296 296 '__MYMARKER__sample.txt', StringIO('sample text')) … … 302 302 # when we create a file of img type, the filename ext is taken 303 303 # from input file. 304 fs = ExtFileStore( )304 fs = ExtFileStore(root=self.workdir) 305 305 result = fs.createFile( 306 306 '__MYMARKER__sample_img.png', StringIO('sample text')) … … 312 312 # we consider registered filename handlers when asking for 313 313 # stored files. 314 fs = ExtFileStore( )314 fs = ExtFileStore(root=self.workdir) 315 315 fs.createFile('__MYMARKER__sample.txt', StringIO('sample text')) 316 316 result1 = fs.getFile('__MYMARKER__sample.txt') … … 325 325 # if we register a file name chooser, we can also get a file 326 326 # by context and attribute 327 fs = ExtFileStore( )327 fs = ExtFileStore(root=self.workdir) 328 328 context = CustomContext() 329 329 file_id1 = IFileStoreNameChooser(context).chooseName() 330 330 file_id2 = IFileStoreNameChooser(context).chooseName(attr='img') 331 331 file_id3 = IFileStoreNameChooser(context).chooseName(attr='doc') 332 fs = ExtFileStore( )332 fs = ExtFileStore(root=self.workdir) 333 333 # create three files for a single context, each which 334 334 # different content … … 365 365 def test_delete_file(self): 366 366 # we can remove stored files from storage 367 fs = ExtFileStore( )367 fs = ExtFileStore(root=self.workdir) 368 368 # First, we store a file in file store 369 369 fs.createFile('sample.txt', StringIO('sample text')) … … 380 380 # if we register a file name chooser, we can also delete a file 381 381 # by context and attribute 382 fs = ExtFileStore( )382 fs = ExtFileStore(root=self.workdir) 383 383 context = CustomContext() 384 384 file_id1 = IFileStoreNameChooser(context).chooseName() 385 385 file_id2 = IFileStoreNameChooser(context).chooseName(attr='img') 386 386 file_id3 = IFileStoreNameChooser(context).chooseName(attr='doc') 387 fs = ExtFileStore( )387 fs = ExtFileStore(root=self.workdir) 388 388 # create three files for a single context, each which 389 389 # different content -
main/waeup.kofa/trunk/src/waeup/kofa/university/tests/test_batching.py
r9087 r9283 310 310 'code=DEP2' 311 311 in logcontent) 312 shutil.rmtree(os.path.dirname(fin_file)) 312 313 313 314 def test_upload_import_reupload(self): -
main/waeup.kofa/trunk/src/waeup/kofa/userscontainer.txt
r8787 r9283 74 74 >>> list(myusers) 75 75 [] 76 77 Clean up: 78 79 >>> import shutil 80 >>> shutil.rmtree(workdir) -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_batching.py
r9217 r9283 392 392 393 393 def __init__(self): 394 dir_path = tempfile.mkdtemp()395 self.result = os.path.join( dir_path, 'fake.csv')394 self.dir_path = tempfile.mkdtemp() 395 self.result = os.path.join(self.dir_path, 'fake.csv') 396 396 open(self.result, 'wb').write('a fake result') 397 397 return … … 551 551 self.assertEqual(result2, ('4', 'cave_exporter', 'bob')) 552 552 self.assertEqual(result3, None) 553 return 553 shutil.rmtree(fake_job.dir_path) 554 return -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_logger.py
r8492 r9283 194 194 self.assertTrue('Warning 2' not in content1) 195 195 self.assertTrue(filename1 != filename2) 196 shutil.rmtree(self.dc_root2) 196 197 return 197 198
Note: See TracChangeset for help on using the changeset viewer.