Ignore:
Timestamp:
11 Jan 2015, 22:43:35 (10 years ago)
Author:
Henrik Bettermann
Message:

We need to provide unique filenames. Let's use the document id for the filename and not the download_name of the respective viewlet.

File:
1 edited

Legend:

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

    r12442 r12444  
    148148            name='upload_pdfscanmanageupload').click()
    149149        self.assertTrue(
    150             'href="http://localhost/app/documents/DOC1/sample.pdf">PDF File</a>'
     150            'href="http://localhost/app/documents/DOC1/file.pdf">DOC1.pdf</a>'
    151151            in self.browser.contents)
    152152        # The file can be found in the file system
    153153        file = getUtility(IExtFileStore).getFileByContext(
    154             document, attr='sample.pdf')
     154            document, attr='file.pdf')
    155155        file_content = file.read()
    156156        pdf.seek(0)
     
    159159        # Browsing the link shows a real pdf only if the document
    160160        # has been published
    161         self.browser.getLink("PDF File").click()
     161        self.browser.getLink("DOC1.pdf").click()
    162162        self.assertTrue(
    163163            'The document requested has not yet been published'
    164164            in self.browser.contents)
    165165        IWorkflowState(document).setState(PUBLISHED)
    166         self.browser.open(self.container_path + '/DOC1/sample.pdf')
     166        self.browser.open(self.container_path + '/DOC1/file.pdf')
    167167        self.assertEqual(
    168168            self.browser.headers['content-type'], 'application/pdf')
     169        # The name of the downloaded file will be different
     170        self.assertEqual(
     171            self.browser.headers['Content-Disposition'],
     172            'attachment; filename="DOC1.pdf')
    169173
    170174        # Transitions can be performed
     
    186190        # File has been removed too
    187191        file = getUtility(IExtFileStore).getFileByContext(
    188             document, attr='sample.pdf')
     192            document, attr='file.pdf')
    189193        self.assertTrue(file is None)
    190194
     
    204208            % document.document_id in logcontent)
    205209        self.assertTrue(
    206             'INFO - zope.mgr - documents.browser.DocumentManageFormPage - %s - uploaded: sample.pdf (my_sample_scan.pdf)'
     210            'INFO - zope.mgr - documents.browser.DocumentManageFormPage - %s - uploaded: file.pdf (my_sample_scan.pdf)'
    207211            % document.document_id in logcontent)
    208212        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.