Changeset 8336
- Timestamp:
- 4 May 2012, 05:14:49 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py
r8334 r8336 32 32 from waeup.kofa.applicants.interfaces import ( 33 33 IApplicantsContainer, IApplicant, IApplicantUpdateByRegNo) 34 from waeup.kofa.applicants.workflow import IMPORTABLE_STATES 34 from waeup.kofa.applicants.workflow import IMPORTABLE_STATES, CREATED 35 35 36 36 class ApplicantsContainerProcessor(BatchProcessor): … … 307 307 conv_dict['application_number'] = IGNORE_MARKER 308 308 return errs, inv_errs, conv_dict 309 310 def checkUpdateRequirements(self, obj, row, site): 311 """Checks requirements the object must fulfill when being updated. 312 313 This method is not used in case of deleting or adding objects. 314 315 Returns error messages as strings in case of requirement 316 problems. 317 """ 318 if obj.state == CREATED: 319 return 'Applicant is blocked.' 320 return None -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_applicant_data.csv
r8291 r8336 3 3 2345,dp2011,1002,Aaren,Finau,1990-01-03,xx@yy.zz,CERT1,m,Claus, 4 4 ,dp2011,1003,Aaren,Berson,1990-01-04,xx@yy.zz,CERT1,m,Alfons, 5 4567,dp2011,1004,Simon,Star,1990-01-05,xx@yy.zz,CERT1,m,Uwe, -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_applicant_data_update2.csv
r8331 r8336 1 applicant_id,reg_number,firstname,middlename 2 dp2011_1234,,Aaren,XXX 3 ,6666,Alfons,XXX 4 ,1003,Abraham,XXX 1 applicant_id,reg_number,firstname,middlename,state 2 dp2011_1234,,Aaren,XXX, 3 ,6666,Alfons,XXX, 4 ,1003,Abraham,XXX, 5 ,1004,Vertan,, -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py
r8335 r8336 25 25 import unittest 26 26 import grok 27 from hurry.workflow.interfaces import IWorkflowState 27 28 from zope.component.hooks import setSite, clearSite 28 29 from zope.component import createObject … … 39 40 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 40 41 from waeup.kofa.interfaces import IBatchProcessor, IUserAccount 42 from waeup.kofa.applicants.workflow import CREATED 41 43 42 44 … … 285 287 self.assertEqual(num_warns,0) 286 288 keys = self.app['applicants']['dp2011'].keys() 287 assert len(keys) == 4289 assert len(keys) == 5 288 290 container = self.app['applicants']['dp2011'] 289 291 assert container.__implemented__.__name__ == ( … … 353 355 self.assertEqual(container['2345'].reg_number, '6666') 354 356 logcontent = open(self.logfile).read() 355 356 357 # Logging message from updateEntry, 357 358 # reg_number is locator … … 364 365 'firstname=Alfons, applicant_id=dp2011_2345' in 365 366 logcontent) 366 367 367 shutil.rmtree(os.path.dirname(fin_file)) 368 368 369 369 # Now we import another file which clears all middlename attributes 370 370 # and uses the new reg_number as locator. This test also checks 371 # if the catalog has been informed about the reg_no change. 371 # if the catalog has been informed about the reg_no change and if 372 # applicants in state created are really blocked. 373 IWorkflowState(container['4567']).setState(CREATED) 372 374 num, num_warns, fin_file, fail_file = self.processor.doImport( 373 375 self.csv_file_update2, APPLICANT_HEADER_FIELDS_UPDATE2, 'update') 374 #content = open(fail_file).read() 375 #print content 376 self.assertEqual(num_warns,0) 376 failcontent = open(fail_file).read() 377 self.assertTrue('Applicant is blocked' in failcontent) 378 self.assertEqual(num_warns,1) 379 # Middlename is cleared. 377 380 assert container['1234'].middlename is None 381 # Firstname of applicant in state created isn't changed. 382 self.assertEqual(container['4567'].firstname, 'Simon') 378 383 shutil.rmtree(os.path.dirname(fin_file)) 379 384 … … 386 391 self.assertEqual(num_warns,0) 387 392 logcontent = open(self.logfile).read() 388 389 393 # Logging message from handle_applicant_transition_event 390 394 self.assertTrue( 391 395 'dp2011_1234 - Applicant record removed' in 392 396 logcontent) 393 394 shutil.rmtree(os.path.dirname(fin_file)) 397 shutil.rmtree(os.path.dirname(fin_file))
Note: See TracChangeset for help on using the changeset viewer.