Changeset 12062 for main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests
- Timestamp:
- 26 Nov 2014, 13:03:56 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12059 r12062 893 893 # Costumer can upload a document. 894 894 self.browser.getLink("Edit").click() 895 ctrl = self.browser.getControl(name='sample editupload')895 ctrl = self.browser.getControl(name='samplescaneditupload') 896 896 file_obj = open(SAMPLE_IMAGE, 'rb') 897 897 file_ctrl = ctrl.mech_control 898 898 file_ctrl.add_file(file_obj, filename='my_document.jpg') 899 899 self.browser.getControl( 900 name='upload_sample editupload').click()900 name='upload_samplescaneditupload').click() 901 901 self.assertTrue( 902 902 'href="http://localhost/app/customers/K1000000/documents/d102/sample"' … … 919 919 # Create a pseudo image file and select it to be uploaded 920 920 image = open(SAMPLE_IMAGE, 'rb') 921 ctrl = self.browser.getControl(name='sample manageupload')921 ctrl = self.browser.getControl(name='samplescanmanageupload') 922 922 file_ctrl = ctrl.mech_control 923 923 file_ctrl.add_file(image, filename='my_sample_scan.jpg') … … 929 929 # ... but the correct upload submit button does 930 930 image = open(SAMPLE_IMAGE) 931 ctrl = self.browser.getControl(name='sample manageupload')931 ctrl = self.browser.getControl(name='samplescanmanageupload') 932 932 file_ctrl = ctrl.mech_control 933 933 file_ctrl.add_file(image, filename='my_sample_scan.jpg') 934 934 self.browser.getControl( 935 name='upload_sample manageupload').click()935 name='upload_samplescanmanageupload').click() 936 936 self.assertTrue( 937 937 'href="http://localhost/app/customers/K1000000/documents/d101/sample"' … … 945 945 self.browser.open(self.customer_path + '/documents/d101/manage') 946 946 self.assertFalse( 947 'upload_sample manageupload' in self.browser.contents)947 'upload_samplescanmanageupload' in self.browser.contents) 948 948 # File must be deleted first 949 self.browser.getControl(name='delete_sample manageupload').click()949 self.browser.getControl(name='delete_samplescanmanageupload').click() 950 950 self.assertTrue( 951 951 'sample deleted' in self.browser.contents) 952 952 # Uploading a file which is bigger than 150k will raise an error 953 953 big_image = StringIO(open(SAMPLE_IMAGE, 'rb').read() * 75) 954 ctrl = self.browser.getControl(name='sample manageupload')954 ctrl = self.browser.getControl(name='samplescanmanageupload') 955 955 file_ctrl = ctrl.mech_control 956 956 file_ctrl.add_file(big_image, filename='my_sample_scan.jpg') 957 957 self.browser.getControl( 958 name='upload_sample manageupload').click()958 name='upload_samplescanmanageupload').click() 959 959 self.assertTrue( 960 960 'Uploaded file is too big' in self.browser.contents) 961 961 # we do not rely on filename extensions given by uploaders 962 962 image = open(SAMPLE_IMAGE, 'rb') # a jpg-file 963 ctrl = self.browser.getControl(name='sample manageupload')963 ctrl = self.browser.getControl(name='samplescanmanageupload') 964 964 file_ctrl = ctrl.mech_control 965 965 # tell uploaded file is bmp 966 966 file_ctrl.add_file(image, filename='my_sample_scan.bmp') 967 967 self.browser.getControl( 968 name='upload_sample manageupload').click()968 name='upload_samplescanmanageupload').click() 969 969 self.assertTrue( 970 970 # jpg file was recognized 971 971 'File sample.jpg uploaded.' in self.browser.contents) 972 972 # Delete file again 973 self.browser.getControl(name='delete_sample manageupload').click()973 self.browser.getControl(name='delete_samplescanmanageupload').click() 974 974 self.assertTrue( 975 975 'sample deleted' in self.browser.contents) 976 976 # File names must meet several conditions 977 977 bmp_image = open(SAMPLE_IMAGE_BMP, 'rb') 978 ctrl = self.browser.getControl(name='sample manageupload')978 ctrl = self.browser.getControl(name='samplescanmanageupload') 979 979 file_ctrl = ctrl.mech_control 980 980 file_ctrl.add_file(bmp_image, filename='my_sample_scan.bmp') 981 981 self.browser.getControl( 982 name='upload_sample manageupload').click()982 name='upload_samplescanmanageupload').click() 983 983 self.assertTrue('Only the following extensions are allowed' 984 984 in self.browser.contents) … … 995 995 # Create a pseudo image file and select it to be uploaded 996 996 image = open(SAMPLE_IMAGE, 'rb') 997 ctrl = self.browser.getControl(name='pdf manageupload')997 ctrl = self.browser.getControl(name='pdfscanmanageupload') 998 998 file_ctrl = ctrl.mech_control 999 999 file_ctrl.add_file(image, filename='my_sample_scan.jpg') 1000 1000 self.browser.getControl( 1001 name='upload_pdf manageupload').click()1001 name='upload_pdfscanmanageupload').click() 1002 1002 self.assertTrue( 1003 1003 'pdf file extension expected' in self.browser.contents) 1004 ctrl = self.browser.getControl(name='pdf manageupload')1004 ctrl = self.browser.getControl(name='pdfscanmanageupload') 1005 1005 file_ctrl = ctrl.mech_control 1006 1006 file_ctrl.add_file(image, filename='my_sample_scan.pdf') 1007 1007 self.browser.getControl( 1008 name='upload_pdf manageupload').click()1008 name='upload_pdfscanmanageupload').click() 1009 1009 self.assertTrue( 1010 1010 'Could not determine file type' in self.browser.contents) 1011 1011 pdf = open(SAMPLE_PDF, 'rb') 1012 ctrl = self.browser.getControl(name='pdf manageupload')1012 ctrl = self.browser.getControl(name='pdfscanmanageupload') 1013 1013 file_ctrl = ctrl.mech_control 1014 1014 file_ctrl.add_file(pdf, filename='my_sample_scan.pdf') 1015 1015 self.browser.getControl( 1016 name='upload_pdf manageupload').click()1016 name='upload_pdfscanmanageupload').click() 1017 1017 self.assertTrue( 1018 1018 'href="http://localhost/app/customers/K1000000/documents/d102/sample.pdf">PDF File</a>' … … 1025 1025 def test_view_slips(self): 1026 1026 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1027 # Officers can open the pdf transcript1027 # Officers can open the document overview 1028 1028 self.browser.open(self.customer_path + '/documents') 1029 1029 self.browser.getLink("Download documents overview").click() … … 1033 1033 open(path, 'wb').write(self.browser.contents) 1034 1034 print "Sample PDF overview_slip.pdf written to %s" % path 1035 # Officers can open document slips 1036 self.browser.open(self.customer_path + '/documents/d101') 1037 self.browser.getLink("Download document slip").click() 1038 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1039 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 1040 path = os.path.join(samples_dir(), 'document_slip.pdf') 1041 open(path, 'wb').write(self.browser.contents) 1042 print "Sample document_slip.pdf written to %s" % path
Note: See TracChangeset for help on using the changeset viewer.