Changeset 12226 for main/waeup.ikoba/trunk/src/waeup/ikoba/documents
- Timestamp:
- 14 Dec 2014, 10:00:06 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_browser.py
r12222 r12226 50 50 51 51 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') 52 SAMPLE_IMAGE_BMP = os.path.join(os.path.dirname(__file__), 'test_image.bmp')52 #SAMPLE_IMAGE_BMP = os.path.join(os.path.dirname(__file__), 'test_image.bmp') 53 53 SAMPLE_PDF = os.path.join(os.path.dirname(__file__), 'test_pdf.pdf') 54 54 … … 124 124 self.assertEqual(self.browser.url, self.container_path + '/d101/index') 125 125 126 # File can be uploaded 127 self.browser.getLink("Manage").click() 128 # Create a pseudo image file and select it to be uploaded 129 image = open(SAMPLE_IMAGE, 'rb') 130 ctrl = self.browser.getControl(name='pdfscanmanageupload') 131 file_ctrl = ctrl.mech_control 132 file_ctrl.add_file(image, filename='my_sample_scan.jpg') 133 self.browser.getControl( 134 name='upload_pdfscanmanageupload').click() 135 self.assertTrue( 136 'pdf file extension expected' in self.browser.contents) 137 ctrl = self.browser.getControl(name='pdfscanmanageupload') 138 file_ctrl = ctrl.mech_control 139 file_ctrl.add_file(image, filename='my_sample_scan.pdf') 140 self.browser.getControl( 141 name='upload_pdfscanmanageupload').click() 142 self.assertTrue( 143 'Could not determine file type' in self.browser.contents) 144 pdf = open(SAMPLE_PDF, 'rb') 145 ctrl = self.browser.getControl(name='pdfscanmanageupload') 146 file_ctrl = ctrl.mech_control 147 file_ctrl.add_file(pdf, filename='my_sample_scan.pdf') 148 self.browser.getControl( 149 name='upload_pdfscanmanageupload').click() 150 self.assertTrue( 151 'href="http://localhost/app/documents/d101/sample.pdf">PDF File</a>' 152 in self.browser.contents) 153 # Browsing the link shows a real pdf 154 self.browser.open('sample.pdf') 155 self.assertEqual( 156 self.browser.headers['content-type'], 'application/pdf') 157 126 158 # Transitions can be performed 159 self.browser.open(self.container_path + '/d101') 127 160 self.browser.getLink("Transition").click() 128 161 self.browser.getControl(name="transition").value = ['publish'] … … 153 186 % document.document_id in logcontent) 154 187 self.assertTrue( 188 'INFO - zope.mgr - documents.browser.DocumentManageFormPage - %s - uploaded: sample.pdf (my_sample_scan.pdf)' 189 % document.document_id in logcontent) 190 self.assertTrue( 155 191 'INFO - zope.mgr - %s - Document published' % document.document_id 156 192 in logcontent) … … 158 194 'INFO - zope.mgr - documents.browser.DocumentsContainerManageFormPage - removed: %s' 159 195 % document.document_id in logcontent) 160
Note: See TracChangeset for help on using the changeset viewer.