Ignore:
Timestamp:
7 Dec 2014, 10:07:29 (10 years ago)
Author:
Henrik Bettermann
Message:

Define connected_files and getMD5 for all kind of customer documents.

File:
1 edited

Legend:

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

    r12151 r12161  
    4343from waeup.ikoba.customers.customer import Customer
    4444from waeup.ikoba.interfaces import (
    45     IUserAccount, IJobManager, APPROVED, SUBMITTED)
     45    IUserAccount, IJobManager, APPROVED, SUBMITTED,
     46    IFileStoreNameChooser, IExtFileStore, IFileStoreHandler)
     47from waeup.ikoba.imagestorage import (
     48    FileStoreNameChooser, ExtFileStore, DefaultFileStoreHandler,
     49    DefaultStorage)
    4650from waeup.ikoba.authentication import LocalRoleSetEvent
    4751from waeup.ikoba.tests.test_async import FunctionalAsyncTestCase
     
    12121216
    12131217    def test_contract_approval(self):
    1214         # This is not a UI test. It just tests the approval
    1215         # of contracts.
     1218        # This is not a UI test. It just a functional test.
    12161219        self.assertRaises(ConstraintNotSatisfied,
    12171220            self.contract.document_object, self.document)
     
    12271230        self.assertEqual(IWorkflowState(self.contract).getState(), 'approved')
    12281231
    1229 
    12301232    def test_contract_approval_in_UI(self):
    12311233        # Now let's see what the UI says why trying to approve a contract
     
    12461248        self.browser.getControl("Save").click()
    12471249        self.assertEqual(IWorkflowState(self.contract).getState(), 'approved')
     1250
     1251    def test_get_setmd5_file(self):
     1252        # A proper file name chooser is registered for customer documents.
     1253        # This is not a UI test. It just a functional test.
     1254        file_id = IFileStoreNameChooser(self.document).chooseName(attr='sample')
     1255        fs = ExtFileStore(root=self.dc_root)
     1256        fs.createFile(file_id, StringIO('my sample 1'))
     1257        result = fs.getFileByContext(self.document, attr='sample')
     1258        self.assertEqual(file_id, '__file-customerdocument__01000/K1000000/sample_d101_K1000000')
     1259        self.assertEqual(result.read(), 'my sample 1')
     1260        self.assertEqual(self.document.connected_files[0][1].read(), 'my sample 1')
     1261        self.document.setMD5()
     1262        self.assertEqual(self.document.sample_md5, 'a406995ee8eb6772bacf51aa4b0caa24')
     1263        return
     1264
Note: See TracChangeset for help on using the changeset viewer.