Ignore:
Timestamp:
27 Feb 2015, 17:39:46 (10 years ago)
Author:
Henrik Bettermann
Message:

Copy over valid_from and valid_to from products when creating contract objects.

Fix ContractProcessorBase?. Do really allow to import tc_dict, valid_from, title and valid_to.

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

    r12580 r12633  
    1 class_name,contract_id,reg_number,product_object,document_object,product_options,tc_dict,title
    2 SampleContract,c3,1,SAM,DOC1,"[('Base Fee', '800.6', 'USD')]",{'en':'Hello World'},Nice Contract
    3 SampleContract,c4,2,SAM,DOC1,[],{},
    4 SampleContract,c5,3,SAM,DOC1,[],{},
    5 SampleContract,,1,SAM,DOC1,[],{},
    6 SampleContract,c5,2,SAM,DOC1,[],{},
    7 SampleContract,c6,3,SAM,NONEXISTENT,[],{},
    8 SampleContract,c7,3,NONEXISTENT,DOC1,[],{},
     1class_name,contract_id,reg_number,product_object,document_object,product_options,tc_dict,title,valid_from,valid_to
     2SampleContract,c3,1,SAM,DOC1,"[('Base Fee', '800.6', 'USD')]",{'en':'Hello World'},Nice Contract,2014-06-25#,2015-06-25#
     3SampleContract,c4,2,SAM,DOC1,[],,,,
     4SampleContract,c5,3,SAM,DOC1,[],,,,
     5SampleContract,,1,SAM,DOC1,[],,,,
     6SampleContract,c5,2,SAM,DOC1,[],,,,
     7SampleContract,c6,3,SAM,NONEXISTENT,[],,,,
     8SampleContract,c7,3,NONEXISTENT,DOC1,[],,,,
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py

    r12580 r12633  
    158158        contract.product_options = self.product.options
    159159        contract.tc_dict = {'en': u'Hello world'}
     160        contract.valid_from = datetime.date(2014, 2, 4)
     161        contract.valid_to = datetime.date(2014, 12, 4)
     162
    160163        customer['contracts'].addContract(contract)
    161164        self.contract = contract
     
    498501        fail_file = open(fail_file).read()
    499502        self.assertEqual(fail_file,
    500             'reg_number,contract_id,title,class_name,product_object,tc_dict,document_object,product_options,--ERRORS--\r\n'
    501             '2,c5,,SampleContract,SAM,{},DOC1,[],This object already exists. Skipping.\r\n'
    502             '3,c6,,SampleContract,SAM,{},NONEXISTENT,[],document_object: Invalid value\r\n'
    503             '3,c7,,SampleContract,NONEXISTENT,{},DOC1,[],product_object: Invalid value\r\n'
     503            'reg_number,valid_from,contract_id,title,class_name,valid_to,product_object,tc_dict,document_object,product_options,--ERRORS--\r\n'
     504            '2,,c5,,SampleContract,,SAM,,DOC1,[],This object already exists. Skipping.\r\n'
     505            '3,,c6,,SampleContract,,SAM,,NONEXISTENT,[],document_object: Invalid value\r\n'
     506            '3,,c7,,SampleContract,,NONEXISTENT,,DOC1,[],product_object: Invalid value\r\n'
    504507            )
    505508        contract = self.processor.getEntry(dict(reg_number='1',
     
    512515        self.assertEqual(contract.product_options[0].currency, 'USD')
    513516        self.assertEqual(contract.contract_id, 'c3')
    514         self.assertEqual(contract.tc_dict, u"{'en':'Hello World'}")
     517        self.assertEqual(contract.title, u'Nice Contract')
     518        self.assertEqual(contract.tc_dict, {'en':'Hello World'})
    515519        contract = self.processor.getEntry(dict(reg_number='3',
    516520            contract_id='c5'), self.app)
     
    523527        self.assertTrue(
    524528            'INFO - system - Customer Sample Contract Processor - sample_contract_data - '
    525             'X666666 - %s - updated: title=, product_object=SAM, tc_dict={}, document_object=DOC1, '
     529            'X666666 - %s - updated: valid_from=, title=, valid_to=, product_object=SAM, tc_dict=, document_object=DOC1, '
    526530            'product_options=[]' % conid
    527531            in logcontent)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py

    r12580 r12633  
    257257            'class_name,comment,contract_category,contract_id,document_object,'
    258258            'history,last_product_id,'
    259             'product_object,product_options,state,tc_dict,title,user_id\r\n'
    260 
    261             'SampleContract,,sample,CON1,,[],,,[],,{},,\r\n'
     259            'product_object,product_options,state,tc_dict,title,user_id,'
     260            'valid_from,valid_to\r\n'
     261
     262            'SampleContract,,sample,CON1,,[],,,[],,{},,,,\r\n'
    262263            )
    263264        return
     
    273274            'class_name,comment,contract_category,contract_id,document_object,'
    274275            'history,last_product_id,'
    275             'product_object,product_options,state,tc_dict,title,user_id\r\n'
     276            'product_object,product_options,state,tc_dict,title,user_id,'
     277            'valid_from,valid_to\r\n'
    276278
    277279            'SampleContract,,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    278280            'Contract created by system\'],,'
    279281            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",'
    280             'created,{\'en\': u\'Hello world\'},,A111111\r\n',
     282            'created,{\'en\': u\'Hello world\'},,A111111,'
     283            '2014-02-04#,2014-12-04#\r\n',
    281284            result
    282285            )
     
    293296            'class_name,comment,contract_category,contract_id,document_object,'
    294297            'history,last_product_id,'
    295             'product_object,product_options,state,tc_dict,title,user_id\r\n'
     298            'product_object,product_options,state,tc_dict,title,user_id,'
     299            'valid_from,valid_to\r\n'
    296300
    297301            'SampleContract,,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    298302            'Contract created by system\'],,'
    299303            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",'
    300             'created,{\'en\': u\'Hello world\'},,A111111\r\n',
     304            'created,{\'en\': u\'Hello world\'},,A111111,'
     305            '2014-02-04#,2014-12-04#\r\n',
    301306            result
    302307            )
     
    313318            'class_name,comment,contract_category,contract_id,document_object,'
    314319            'history,last_product_id,'
    315             'product_object,product_options,state,tc_dict,title,user_id\r\n'
     320            'product_object,product_options,state,tc_dict,title,user_id,'
     321            'valid_from,valid_to\r\n'
    316322
    317323            'SampleContract,,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    318324            'Contract created by system\'],,'
    319325            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",'
    320             'created,{\'en\': u\'Hello world\'},,A111111\r\n',
    321             result
    322             )
    323         return
    324 
     326            'created,{\'en\': u\'Hello world\'},,A111111,'
     327            '2014-02-04#,2014-12-04#\r\n',
     328            result
     329            )
     330        return
     331
Note: See TracChangeset for help on using the changeset viewer.