Changeset 12131 for main/waeup.ikoba/trunk/src/waeup
- Timestamp:
- 3 Dec 2014, 18:12:59 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_contract_data.csv
r12125 r12131 1 class_name,contract_id,reg_number,title 2 SampleContract,c3,1,My first contract 3 SampleContract,c4,2,My second contract 4 SampleContract,c5,3,My third contract 5 SampleContract,,1,My 4th contract 6 SampleContract,c5,2,My stolen contract 1 class_name,contract_id,reg_number,title,product_object,document_object 2 SampleContract,c3,1,My first contract,SAM,d101 3 SampleContract,c4,2,My second contract,SAM,d101 4 SampleContract,c5,3,My third contract,SAM,d101 5 SampleContract,,1,My 4th contract,SAM,d101 6 SampleContract,c5,2,My stolen contract,SAM,d101 7 SampleContract,c6,3,My 5th contract,SAM,NONEXISTENT 8 SampleContract,c7,3,My sixt contract,NONEXISTENT,d101 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py
r12125 r12131 34 34 35 35 from waeup.ikoba.app import Company 36 from waeup.ikoba.interfaces import IBatchProcessor, FatalCSVError, IUserAccount 36 from waeup.ikoba.interfaces import ( 37 IBatchProcessor, FatalCSVError, IUserAccount, VERIFIED) 37 38 from waeup.ikoba.customers.batching import ( 38 39 CustomerProcessor, CustomerDocumentProcessor, ContractProcessor) … … 132 133 document.title = u'My Document' 133 134 customer['documents'].addDocument(document) 135 IWorkflowState(document).setState(VERIFIED) 134 136 self.document = document 135 137 # Add contract … … 464 466 def test_checkConversion(self): 465 467 errs, inv_errs, conv_dict = self.processor.checkConversion( 466 dict(contract_id='c126', class_name='SampleContract')) 468 dict(contract_id='c126', class_name='SampleContract', 469 document_object='d101', product_object='SAM')) 467 470 self.assertEqual(len(errs),0) 468 471 errs, inv_errs, conv_dict = self.processor.checkConversion( … … 476 479 num, num_warns, fin_file, fail_file = self.processor.doImport( 477 480 self.csv_file, CONTRACT_HEADER_FIELDS,'create') 478 self.assertEqual(num_warns, 1)481 self.assertEqual(num_warns,3) 479 482 # contract_id must be unique 480 483 fail_file = open(fail_file).read() 481 484 self.assertEqual(fail_file, 482 'class_name,reg_number,contract_id,title,--ERRORS--\r\n' 483 'SampleContract,2,c5,My stolen contract,contract_id: id exists\r\n') 485 'reg_number,contract_id,title,class_name,product_object,' 486 'document_object,--ERRORS--\r\n' 487 '2,c5,My stolen contract,SampleContract,SAM,d101,' 488 'contract_id: id exists\r\n' 489 '3,c6,My 5th contract,SampleContract,SAM,NONEXISTENT,' 490 'document_object: Invalid value\r\n' 491 '3,c7,My sixt contract,SampleContract,NONEXISTENT,d101,' 492 'product_object: Invalid value\r\n') 484 493 contract = self.processor.getEntry(dict(reg_number='1', 485 494 contract_id='c3'), self.app) … … 508 517 num, num_warns, fin_file, fail_file = self.processor.doImport( 509 518 self.csv_file, CONTRACT_HEADER_FIELDS,'update') 510 # There is one record without contract_id and one duplicate 511 self.assertEqual(num_warns,2) 519 # There are one record without contract_id, one duplicate and two 520 # records with wrong object identifier. 521 self.assertEqual(num_warns,4) 512 522 shutil.rmtree(os.path.dirname(fin_file)) 513 523 … … 521 531 num, num_warns, fin_file, fail_file = self.processor.doImport( 522 532 self.csv_file, CONTRACT_HEADER_FIELDS,'remove') 523 # There is one record without contract_id and one duplicate 524 self.assertEqual(num_warns,2) 533 # There are one record without contract_id, one duplicate and two 534 # records with wrong object identifier. 535 self.assertEqual(num_warns,4) 525 536 shutil.rmtree(os.path.dirname(fin_file)) 526 537 logcontent = open(self.logfile).read() -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py
r12076 r12131 159 159 self.assertEqual( 160 160 result, 161 'class_name,document_id,history,last_transition_date,state,title, customer_id\r\n'161 'class_name,document_id,history,last_transition_date,state,title,user_id\r\n' 162 162 'CustomerSampleDocument,d101,[],,,,\r\n' 163 163 ) … … 173 173 result = open(self.outfile, 'rb').read() 174 174 self.assertTrue( 175 'class_name,document_id,history,last_transition_date,state,title, customer_id\r\n'175 'class_name,document_id,history,last_transition_date,state,title,user_id\r\n' 176 176 in result 177 177 ) … … 179 179 '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - ' 180 180 'Document created by system\'],2014-11-25 06:57:24.990308#,' 181 ' created,My Document,A111111...',181 'verified,My Document,A111111...', 182 182 result 183 183 ) … … 192 192 result = open(self.outfile, 'rb').read() 193 193 self.assertTrue( 194 'class_name,document_id,history,last_transition_date,state,title, customer_id\r\n'194 'class_name,document_id,history,last_transition_date,state,title,user_id\r\n' 195 195 in result) 196 196 self.assertMatches( 197 197 '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - ' 198 198 'Document created by system\'],2014-11-25 06:57:24.990308#,' 199 ' created,My Document,A111111...',199 'verified,My Document,A111111...', 200 200 result 201 201 ) … … 210 210 result = open(self.outfile, 'rb').read() 211 211 self.assertTrue( 212 'class_name,document_id,history,last_transition_date,state,title, customer_id\r\n'212 'class_name,document_id,history,last_transition_date,state,title,user_id\r\n' 213 213 in result) 214 214 self.assertMatches( 215 215 '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - ' 216 216 'Document created by system\'],2014-11-25 06:57:24.990308#,' 217 ' created,My Document,A111111...',217 'verified,My Document,A111111...', 218 218 result 219 219 )
Note: See TracChangeset for help on using the changeset viewer.