Ignore:
Timestamp:
3 Dec 2014, 18:12:59 (10 years ago)
Author:
Henrik Bettermann
Message:

Adjust tests.

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
     1class_name,contract_id,reg_number,title,product_object,document_object
     2SampleContract,c3,1,My first contract,SAM,d101
     3SampleContract,c4,2,My second contract,SAM,d101
     4SampleContract,c5,3,My third contract,SAM,d101
     5SampleContract,,1,My 4th contract,SAM,d101
     6SampleContract,c5,2,My stolen contract,SAM,d101
     7SampleContract,c6,3,My 5th contract,SAM,NONEXISTENT
     8SampleContract,c7,3,My sixt contract,NONEXISTENT,d101
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py

    r12125 r12131  
    3434
    3535from waeup.ikoba.app import Company
    36 from waeup.ikoba.interfaces import IBatchProcessor, FatalCSVError, IUserAccount
     36from waeup.ikoba.interfaces import (
     37    IBatchProcessor, FatalCSVError, IUserAccount, VERIFIED)
    3738from waeup.ikoba.customers.batching import (
    3839    CustomerProcessor, CustomerDocumentProcessor, ContractProcessor)
     
    132133        document.title = u'My Document'
    133134        customer['documents'].addDocument(document)
     135        IWorkflowState(document).setState(VERIFIED)
    134136        self.document = document
    135137        # Add contract
     
    464466    def test_checkConversion(self):
    465467        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'))
    467470        self.assertEqual(len(errs),0)
    468471        errs, inv_errs, conv_dict = self.processor.checkConversion(
     
    476479        num, num_warns, fin_file, fail_file = self.processor.doImport(
    477480            self.csv_file, CONTRACT_HEADER_FIELDS,'create')
    478         self.assertEqual(num_warns,1)
     481        self.assertEqual(num_warns,3)
    479482        # contract_id must be unique
    480483        fail_file = open(fail_file).read()
    481484        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')
    484493        contract = self.processor.getEntry(dict(reg_number='1',
    485494            contract_id='c3'), self.app)
     
    508517        num, num_warns, fin_file, fail_file = self.processor.doImport(
    509518            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)
    512522        shutil.rmtree(os.path.dirname(fin_file))
    513523
     
    521531        num, num_warns, fin_file, fail_file = self.processor.doImport(
    522532            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)
    525536        shutil.rmtree(os.path.dirname(fin_file))
    526537        logcontent = open(self.logfile).read()
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py

    r12076 r12131  
    159159        self.assertEqual(
    160160            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'
    162162            'CustomerSampleDocument,d101,[],,,,\r\n'
    163163            )
     
    173173        result = open(self.outfile, 'rb').read()
    174174        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'
    176176            in result
    177177            )
     
    179179            '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - '
    180180            'Document created by system\'],2014-11-25 06:57:24.990308#,'
    181             'created,My Document,A111111...',
     181            'verified,My Document,A111111...',
    182182            result
    183183            )
     
    192192        result = open(self.outfile, 'rb').read()
    193193        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'
    195195            in result)
    196196        self.assertMatches(
    197197            '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - '
    198198            'Document created by system\'],2014-11-25 06:57:24.990308#,'
    199             'created,My Document,A111111...',
     199            'verified,My Document,A111111...',
    200200            result
    201201            )
     
    210210        result = open(self.outfile, 'rb').read()
    211211        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'
    213213            in result)
    214214        self.assertMatches(
    215215            '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - '
    216216            'Document created by system\'],2014-11-25 06:57:24.990308#,'
    217             'created,My Document,A111111...',
     217            'verified,My Document,A111111...',
    218218            result
    219219            )
Note: See TracChangeset for help on using the changeset viewer.