Ignore:
Timestamp:
27 Dec 2014, 10:05:03 (10 years ago)
Author:
Henrik Bettermann
Message:

Adjust contract exporter and extend exporter tests.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/export.py

    r12297 r12330  
    231231            if mangled_value:
    232232                return mangled_value
     233        if name == 'product_options' and value is not None:
     234            value = [eval(entry.to_string()) for entry in value]
    233235        return super(
    234236            ContractExporterBase, self).mangle_value(
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py

    r12283 r12330  
    2525import datetime
    2626import grok
     27from decimal import Decimal
    2728from time import time
    2829from zope.event import notify
     
    4041from waeup.ikoba.customers.customer import Customer
    4142from waeup.ikoba.customers.documents import CustomerSampleDocument
     43from waeup.ikoba.products.productoptions import ProductOption
    4244from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
    4345
     
    99101        self.product.title = u'Our Samle Product'
    100102        self.product.contract_category = u'sample'
     103        option = ProductOption()
     104        option.title = u'Base Fee'
     105        option.fee = Decimal('800.6')
     106        option.currency = 'usd'
     107        self.product.options = [option,]
    101108        self.app['products'].addProduct(self.product)
    102109        return
     
    142149        contract.product_object = self.product
    143150        contract.document_object = self.document
     151        contract.product_options = self.product.options
    144152        customer['contracts'].addContract(contract)
    145153        self.contract = contract
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py

    r12289 r12330  
    257257            'class_name,contract_category,contract_id,document_object,'
    258258            'history,last_product_id,'
    259             'product_object,state,title,user_id\r\n'
    260 
    261             'SampleContract,sample,CON1,,[],,,,,\r\n'
     259            'product_object,product_options,state,title,user_id\r\n'
     260
     261            'SampleContract,sample,CON1,,[],,,[],,,\r\n'
    262262            )
    263263        return
     
    273273            'class_name,contract_category,contract_id,document_object,'
    274274            'history,last_product_id,'
    275             'product_object,state,title,user_id\r\n'
     275            'product_object,product_options,state,title,user_id\r\n'
    276276
    277277            'SampleContract,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    278278            'Contract created by system\'],,'
    279             'SAM,created,My Contract,A111111\r\n',
     279            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",'
     280            'created,My Contract,A111111\r\n',
    280281            result
    281282            )
     
    292293            'class_name,contract_category,contract_id,document_object,'
    293294            'history,last_product_id,'
    294             'product_object,state,title,user_id\r\n'
     295            'product_object,product_options,state,title,user_id\r\n'
    295296
    296297            'SampleContract,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    297298            'Contract created by system\'],,'
    298             'SAM,created,My Contract,A111111\r\n',
     299            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",'
     300            'created,My Contract,A111111\r\n',
    299301            result
    300302            )
     
    311313            'class_name,contract_category,contract_id,document_object,'
    312314            'history,last_product_id,'
    313             'product_object,state,title,user_id\r\n'
     315            'product_object,product_options,state,title,user_id\r\n'
    314316
    315317            'SampleContract,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    316318            'Contract created by system\'],,'
    317             'SAM,created,My Contract,A111111\r\n',
    318             result
    319             )
    320         return
    321 
     319            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'usd\')]",'
     320            'created,My Contract,A111111\r\n',
     321            result
     322            )
     323        return
     324
Note: See TracChangeset for help on using the changeset viewer.