Changeset 12058 for main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Timestamp:
- 25 Nov 2014, 17:09:05 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/fileviewlets.py
r12057 r12058 313 313 title = _(u'PDF File') 314 314 mus = 1024 * 200 315 download_name = u' pdffile'315 download_name = u'sample.pdf' 316 316 tab_redirect = '#tab2' 317 317 … … 333 333 label = _(u'PDF Scan') 334 334 title = _(u'PDF Scan') 335 download_name = u' pdf'335 download_name = u'sample.pdf' 336 336 337 337 … … 339 339 """Scan document. 340 340 """ 341 grok.name(' pdf')341 grok.name('sample.pdf') 342 342 grok.context(CustomerPDFDocument) 343 343 grok.require('waeup.viewCustomer') 344 download_name = u' pdf'344 download_name = u'sample.pdf' -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12057 r12058 50 50 SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg') 51 51 SAMPLE_IMAGE_BMP = os.path.join(os.path.dirname(__file__), 'test_image.bmp') 52 SAMPLE_PDF = os.path.join(os.path.dirname(__file__), 'test_pdf.pdf') 52 53 53 54 def lookup_submit_value(name, value, browser): … … 861 862 % document.document_id in logcontent) 862 863 863 def test_edit_ document(self):864 def test_edit_sample_document(self): 864 865 # Customers can manage documents under certain conditions 865 866 self.browser.open(self.login_path) … … 911 912 self.assertTrue('The requested form is locked' in self.browser.contents) 912 913 913 def test_manage_upload_ file(self):914 def test_manage_upload_sample_file(self): 914 915 # Managers can upload a file via the DocumentManageFormPage 915 916 # The image is stored even if form has errors … … 983 984 in self.browser.contents) 984 985 986 def test_manage_upload_pdf_file(self): 987 # Managers can upload a file via the DocumentManageFormPage 988 # The image is stored even if form has errors 989 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 990 self.browser.open(self.customer_path + '/documents') 991 self.browser.getLink("Add document").click() 992 self.browser.getControl(name="doctype").value = ['CustomerPDFDocument'] 993 self.browser.getControl("Create document").click() 994 self.browser.open(self.documents_path + '/d102/manage') 995 # Create a pseudo image file and select it to be uploaded 996 image = open(SAMPLE_IMAGE, 'rb') 997 ctrl = self.browser.getControl(name='pdfmanageupload') 998 file_ctrl = ctrl.mech_control 999 file_ctrl.add_file(image, filename='my_sample_scan.jpg') 1000 self.browser.getControl( 1001 name='upload_pdfmanageupload').click() 1002 self.assertTrue( 1003 'pdf file extension expected' in self.browser.contents) 1004 ctrl = self.browser.getControl(name='pdfmanageupload') 1005 file_ctrl = ctrl.mech_control 1006 file_ctrl.add_file(image, filename='my_sample_scan.pdf') 1007 self.browser.getControl( 1008 name='upload_pdfmanageupload').click() 1009 self.assertTrue( 1010 'Could not determine file type' in self.browser.contents) 1011 pdf = open(SAMPLE_PDF, 'rb') 1012 ctrl = self.browser.getControl(name='pdfmanageupload') 1013 file_ctrl = ctrl.mech_control 1014 file_ctrl.add_file(pdf, filename='my_sample_scan.pdf') 1015 self.browser.getControl( 1016 name='upload_pdfmanageupload').click() 1017 self.assertTrue( 1018 'href="http://localhost/app/customers/K1000000/documents/d102/sample.pdf">PDF File</a>' 1019 in self.browser.contents) 1020 # Browsing the link shows a real pdf 1021 self.browser.open('sample.pdf') 1022 self.assertEqual( 1023 self.browser.headers['content-type'], 'application/pdf') 985 1024 986 1025 def test_view_slips(self):
Note: See TracChangeset for help on using the changeset viewer.