Ignore:
Timestamp:
22 Nov 2014, 18:19:07 (10 years ago)
Author:
Henrik Bettermann
Message:

Test file upload by customer.

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

Legend:

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

    r12035 r12036  
    3636    CustomerBaseDisplayFormPage, CustomerBaseManageFormPage,
    3737    CustomerFilesUploadPage,
    38     DocumentDisplayFormPage, DocumentManageFormPage)
     38    DocumentDisplayFormPage, DocumentManageFormPage, DocumentEditFormPage)
    3939
    4040grok.context(IIkobaObject)  # Make IIkobaObject the default context
     
    258258
    259259class GenericUploadManage(FileUpload):
    260     """Genric document upload viewlet for officers.
     260    """Generic document upload viewlet for officers.
    261261    """
    262262    grok.order(1)
     
    270270    tab_redirect = '#tab2'
    271271
     272
     273class GenericUploadEdit(GenericUploadManage):
     274    """Generic document upload viewlet for customer.
     275    """
     276    grok.view(DocumentEditFormPage)
     277    grok.require('waeup.handleCustomer')
     278
     279
    272280class GenericDisplay(FileDisplay):
    273281    """Genreric document display viewlet.
     
    281289    download_name = u'generic'
    282290
     291
    283292class GenericImage(Image):
    284293    """Generic document.
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12034 r12036  
    864864        self.browser.getLink("View").click()
    865865        self.assertEqual(self.browser.url, self.documents_path + '/d102/index')
     866        # Costumer can upload a document.
     867        self.browser.getLink("Edit").click()
     868        ctrl = self.browser.getControl(name='genericuploadedit')
     869        file_obj = open(SAMPLE_IMAGE, 'rb')
     870        file_ctrl = ctrl.mech_control
     871        file_ctrl.add_file(file_obj, filename='my_document.jpg')
     872        self.browser.getControl(
     873            name='upload_genericuploadedit').click()
     874        self.assertTrue(
     875            'href="http://localhost/app/customers/K1000000/documents/d102/generic"'
     876            in self.browser.contents)
    866877        # Costumer can submit the form. The form is also saved.
    867         self.browser.getLink("Edit").click()
    868878        self.browser.getControl(name="form.title").value = 'My third doc'
    869879        self.browser.getControl("Final Submit").click()
Note: See TracChangeset for help on using the changeset viewer.