Changeset 9239 for main/kofacustom.nigeria/trunk/src
- Timestamp:
- 27 Sep 2012, 06:48:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py
r9046 r9239 25 25 from zope.interface import verify 26 26 from waeup.kofa.app import University 27 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 27 from waeup.kofa.students.tests.test_browser import ( 28 StudentsFullSetup, SAMPLE_IMAGE) 28 29 from waeup.kofa.testing import FunctionalTestCase 29 30 from waeup.kofa.interfaces import ( … … 249 250 self.assertTrue('Clearance has been requested' 250 251 in self.browser.contents) 252 253 def test_manage_upload_file(self): 254 # Managers can upload a file via the StudentClearanceManageFormPage 255 # The image is stored even if form has errors 256 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 257 self.browser.open(self.manage_clearance_path) 258 # Managers can add and delete a file 259 self.browser.open(self.manage_clearance_path) 260 image = open(SAMPLE_IMAGE, 'rb') 261 ctrl = self.browser.getControl(name='birthcertificateupload') 262 file_ctrl = ctrl.mech_control 263 file_ctrl.add_file(image, filename='my_acceptance_letter.jpg') 264 self.browser.getControl( 265 name='upload_acceptanceletterupload').click() 266 # Uups, we used the wrong 'Browse' field 267 self.assertFalse( 268 '<a target="image" href="acc_let">' 269 in self.browser.contents) 270 ctrl = self.browser.getControl(name='acceptanceletterupload') 271 file_ctrl = ctrl.mech_control 272 image.seek(0) 273 file_ctrl.add_file(image, filename='my_acceptance_letter.jpg') 274 self.browser.getControl( 275 name='upload_acceptanceletterupload').click() 276 self.assertTrue( 277 '<a target="image" href="acc_let">' 278 in self.browser.contents) 279 self.browser.getControl( 280 name='delete_acceptanceletterupload').click() 281 self.assertTrue( 282 'acc_let deleted' 283 in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.