Ignore:
Timestamp:
15 Dec 2014, 07:44:01 (10 years ago)
Author:
Henrik Bettermann
Message:

Protect pdf download if document has not been published.

Add workflow transition 'retract'.

File:
1 edited

Legend:

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

    r12239 r12240  
    3737from waeup.ikoba.app import Company
    3838from waeup.ikoba.interfaces import (
    39     IUserAccount, IJobManager, APPROVED, SUBMITTED,
     39    IUserAccount, IJobManager, APPROVED, SUBMITTED, PUBLISHED,
    4040    IFileStoreNameChooser, IExtFileStore, IFileStoreHandler)
    4141from waeup.ikoba.imagestorage import (
     
    151151            'href="http://localhost/app/documents/d101/sample.pdf">PDF File</a>'
    152152            in self.browser.contents)
    153         # Browsing the link shows a real pdf
    154         self.browser.open('sample.pdf')
     153        # Browsing the link shows a real pdf only if the document
     154        # has been published
     155        self.browser.getLink("PDF File").click()
     156        self.assertTrue(
     157            'The document requested has not yet been published'
     158            in self.browser.contents)
     159        IWorkflowState(document).setState(PUBLISHED)
     160        self.browser.getLink("sample.pdf").click()
    155161        self.assertEqual(
    156162            self.browser.headers['content-type'], 'application/pdf')
    157163
    158164        # Transitions can be performed
     165        self.assertEqual(document.state, 'published')
    159166        self.browser.open(self.container_path + '/d101')
    160167        self.browser.getLink("Transition").click()
    161         self.browser.getControl(name="transition").value = ['publish']
     168        self.browser.getControl(name="transition").value = ['retract']
    162169        self.browser.getControl("Save").click()
    163         self.assertEqual(document.state, 'published')
     170        self.assertEqual(document.state, 'created')
    164171
    165172        # Documents can be removed
     
    189196            % document.document_id in logcontent)
    190197        self.assertTrue(
    191             'INFO - zope.mgr - %s - Document published' % document.document_id
     198            'INFO - zope.mgr - %s - Document retracted' % document.document_id
    192199            in logcontent)
    193200        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.