Ignore:
Timestamp:
11 Dec 2014, 16:34:01 (10 years ago)
Author:
Henrik Bettermann
Message:

Show documents on contract slip.

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

Legend:

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

    r12184 r12196  
    13461346    """Deliver pdf file including metadata.
    13471347    """
    1348     grok.context(IContract)
     1348    grok.context(ISampleContract)
    13491349    grok.name('contract_slip.pdf')
    13501350    grok.require('waeup.viewCustomer')
     
    13541354                   'suspended_comment',)
    13551355
    1356     #form_fields = grok.AutoFields(ICustomerPDFContract).omit(
    1357     #    'last_transition_date')
    1358     form_fields =()
     1356    form_fields = grok.AutoFields(ISampleContract).omit(
     1357        'last_transition_date')
    13591358
    13601359    @property
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/contracts.py

    r12168 r12196  
    7878            self.contract_id = generate_contract_id()
    7979        except AttributeError:
    80             self.contract_id = u'a123'
     80            self.contract_id = u'c999'
    8181        self.last_product_id = None
    8282        return
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12186 r12196  
    156156
    157157
    158 
    159158class CustomersContainerUITests(CustomersFullSetup):
    160159    # Tests for CustomersContainer class views and pages
     
    11101109        open(path, 'wb').write(self.browser.contents)
    11111110        print "Sample pdfdocument_slip.pdf written to %s" % path
     1111
     1112    def test_get_setmd5_file(self):
     1113        # A proper file name chooser is registered for customer documents.
     1114        # This is not a UI test. It's just a functional test.
     1115        file_id = IFileStoreNameChooser(self.document).chooseName(attr='sample')
     1116        fs = ExtFileStore(root=self.dc_root)
     1117        fs.createFile(file_id, StringIO('my sample 1'))
     1118        result = fs.getFileByContext(self.document, attr='sample')
     1119        self.assertEqual(file_id, '__file-customerdocument__01000/K1000000/sample_d101_K1000000')
     1120        self.assertEqual(result.read(), 'my sample 1')
     1121        self.assertEqual(self.document.connected_files[0][1].read(), 'my sample 1')
     1122        self.document.setMD5()
     1123        self.assertEqual(self.document.sample_md5, 'a406995ee8eb6772bacf51aa4b0caa24')
     1124        return
    11121125
    11131126
     
    12591272        open(path, 'wb').write(self.browser.contents)
    12601273        print "Sample PDF overview_slip.pdf written to %s" % path
    1261         # Officers can open contract slips
     1274        # Officers can open contract slips.
     1275        # First we add a submitted document and a product.
     1276        IWorkflowState(self.document).setState(SUBMITTED)
     1277        self.contract.document_object = self.document
     1278        self.contract.product_object = self.product
    12621279        self.browser.open(self.customer_path + '/contracts/c101')
    12631280        self.browser.getLink("Download contract slip").click()
     
    13011318        self.browser.getControl("Save").click()
    13021319        self.assertEqual(IWorkflowState(self.contract).getState(), 'approved')
    1303 
    1304     def test_get_setmd5_file(self):
    1305         # A proper file name chooser is registered for customer documents.
    1306         # This is not a UI test. It just a functional test.
    1307         file_id = IFileStoreNameChooser(self.document).chooseName(attr='sample')
    1308         fs = ExtFileStore(root=self.dc_root)
    1309         fs.createFile(file_id, StringIO('my sample 1'))
    1310         result = fs.getFileByContext(self.document, attr='sample')
    1311         self.assertEqual(file_id, '__file-customerdocument__01000/K1000000/sample_d101_K1000000')
    1312         self.assertEqual(result.read(), 'my sample 1')
    1313         self.assertEqual(self.document.connected_files[0][1].read(), 'my sample 1')
    1314         self.document.setMD5()
    1315         self.assertEqual(self.document.sample_md5, 'a406995ee8eb6772bacf51aa4b0caa24')
    1316         return
    1317 
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_contract.py

    r12097 r12196  
    6262        self.assertRaises(TypeError, container.addContract, object())
    6363        self.assertEqual(contract.class_name, 'SampleContract')
    64         self.assertEqual(id, 'a123')
     64        self.assertEqual(id, 'c999')
    6565        return
    6666
Note: See TracChangeset for help on using the changeset viewer.