Ignore:
Timestamp:
2 Jan 2015, 07:50:34 (10 years ago)
Author:
Henrik Bettermann
Message:

Save 'terms and conditions' when adding a contract.

Prevent changing product_object after adding contract.

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/test_batching.py

    r12358 r12363  
    150150        contract.document_object = self.document
    151151        contract.product_options = self.product.options
     152        contract.tc_dict = {'en': u'Hello world'}
    152153        customer['contracts'].addContract(contract)
    153154        self.contract = contract
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12358 r12363  
    107107        self.product.contract_category = u'sample'
    108108        self.product.valid_from = date(2015, 12, 4)
     109        self.product.tc_dict = {'en': u'Hello world'}
    109110        prodoption = ProductOption()
    110111        prodoption.title = u'First option'
     
    11791180        conid = [i for i in self.customer['contracts'].keys() if len(i) > 10][0]
    11801181        contract = self.customer['contracts'][conid]
    1181 
    1182         # Contract can be edited
    1183         self.browser.getLink(conid[:6]).click()
    1184         self.browser.getLink("Manage").click()
     1182        self.assertEqual(
     1183            self.browser.url, self.contracts_path + '/%s/selectproduct' % conid)
     1184        # SAM is in the correct contract_category ...
     1185        self.assertTrue('<option value="SAM">' in self.browser.contents)
     1186        # ... but NOTSAM not.
     1187        self.assertFalse('<option value="LIC">' in self.browser.contents)
     1188        # So far last_product_id is None.
     1189        self.assertTrue(self.customer['contracts'][conid].last_product_id is None)
    11851190        self.browser.getControl(name="form.product_object").value = ['SAM']
    1186         self.browser.getControl("Save").click()
    1187         self.assertTrue('Form has been saved.' in self.browser.contents)
     1191        self.browser.getControl("Save and proceed").click()
     1192        self.assertEqual(
     1193            self.browser.url, self.contracts_path + '/%s/manage' % conid)
    11881194        self.browser.getLink("View").click()
    11891195        self.assertEqual(self.browser.url, self.contracts_path + '/%s/index' % conid)
     1196        self.assertEqual(contract.tc_dict, {'en': u'Hello world'})
    11901197
    11911198        # Transitions can be performed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py

    r12342 r12363  
    257257            'class_name,contract_category,contract_id,document_object,'
    258258            'history,last_product_id,'
    259             'product_object,product_options,state,title,user_id\r\n'
    260 
    261             'SampleContract,sample,CON1,,[],,,[],,,\r\n'
     259            'product_object,product_options,state,tc_dict,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,product_options,state,title,user_id\r\n'
     275            'product_object,product_options,state,tc_dict,title,user_id\r\n'
    276276
    277277            'SampleContract,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    278278            'Contract created by system\'],,'
    279279            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",'
    280             'created,Our Sample Product,A111111\r\n',
     280            'created,{\'en\': u\'Hello world\'},Our Sample Product,A111111\r\n',
    281281            result
    282282            )
     
    293293            'class_name,contract_category,contract_id,document_object,'
    294294            'history,last_product_id,'
    295             'product_object,product_options,state,title,user_id\r\n'
     295            'product_object,product_options,state,tc_dict,title,user_id\r\n'
    296296
    297297            'SampleContract,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    298298            'Contract created by system\'],,'
    299299            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",'
    300             'created,Our Sample Product,A111111\r\n',
     300            'created,{\'en\': u\'Hello world\'},Our Sample Product,A111111\r\n',
    301301            result
    302302            )
     
    313313            'class_name,contract_category,contract_id,document_object,'
    314314            'history,last_product_id,'
    315             'product_object,product_options,state,title,user_id\r\n'
     315            'product_object,product_options,state,tc_dict,title,user_id\r\n'
    316316
    317317            'SampleContract,sample,CON1,DOC1,[u\'2014-12-04 12:10:46 UTC - '
    318318            'Contract created by system\'],,'
    319319            'SAM,"[(u\'Base Fee\', u\'800.6\', u\'USD\')]",'
    320             'created,Our Sample Product,A111111\r\n',
    321             result
    322             )
    323         return
    324 
     320            'created,{\'en\': u\'Hello world\'},Our Sample Product,A111111\r\n',
     321            result
     322            )
     323        return
     324
Note: See TracChangeset for help on using the changeset viewer.