Changeset 7111 for main/waeup.sirp/trunk/src/waeup/sirp/students/tests
- Timestamp:
- 14 Nov 2011, 12:17:54 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7110 r7111 374 374 ctrl = self.browser.getControl(name='birth_certificate') 375 375 file_ctrl = ctrl.mech_control 376 file_ctrl.add_file(pseudo_image, filename='my photo.jpg')376 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg') 377 377 # The Save action does not upload files 378 378 self.browser.getControl("Save (no upload)").click() # submit form … … 380 380 '<a target="image" href="birth_certificate.jpg">' 381 381 in self.browser.contents) 382 # ... but the Upload submit button does382 # ... but the correct upload submit button does 383 383 pseudo_image = StringIO('I pretend to be a graphics file') 384 384 ctrl = self.browser.getControl(name='birth_certificate') 385 385 file_ctrl = ctrl.mech_control 386 file_ctrl.add_file(pseudo_image, filename='my photo.jpg')387 self.browser.getControl( "Upload").click()386 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg') 387 self.browser.getControl(name='upload_birth_certificate').click() 388 388 # There is a correct <img> link included 389 389 self.assertTrue( … … 401 401 ctrl = self.browser.getControl(name='birth_certificate') 402 402 file_ctrl = ctrl.mech_control 403 file_ctrl.add_file(pseudo_image, filename='my photo.jpg')404 self.browser.getControl( "Upload").click()403 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg') 404 self.browser.getControl(name='upload_birth_certificate').click() 405 405 self.assertTrue( 406 406 'Uploaded file is too big' in self.browser.contents) … … 410 410 file_ctrl = ctrl.mech_control 411 411 file_ctrl.add_file(pseudo_image, filename='my.photo.jpg') 412 self.browser.getControl( "Upload").click()412 self.browser.getControl(name='upload_birth_certificate').click() 413 413 self.assertTrue('File name contains more than one dot' 414 414 in self.browser.contents) 415 415 ctrl = self.browser.getControl(name='birth_certificate') 416 416 file_ctrl = ctrl.mech_control 417 file_ctrl.add_file(pseudo_image, filename='my photo')418 self.browser.getControl( "Upload").click()417 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate') 418 self.browser.getControl(name='upload_birth_certificate').click() 419 419 self.assertTrue('File name has no extension' in self.browser.contents) 420 420 ctrl = self.browser.getControl(name='birth_certificate') 421 421 file_ctrl = ctrl.mech_control 422 file_ctrl.add_file(pseudo_image, filename='my photo.bmp')423 self.browser.getControl( "Upload").click()422 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.bmp') 423 self.browser.getControl(name='upload_birth_certificate').click() 424 424 self.assertTrue('.jpg file extension expected' in self.browser.contents) 425 425 # Managers can delete files 426 self.browser.getControl( "Delete").click()426 self.browser.getControl(name='delete_birth_certificate').click() 427 427 self.assertTrue( 428 428 'File birth_certificate.jpg deleted' 429 in self.browser.contents) 430 # Managers can add and delete second file 431 self.browser.open(self.edit_clearance_student_path) 432 pseudo_image = StringIO('I pretend to be a graphics file') 433 ctrl = self.browser.getControl(name='birth_certificate') 434 file_ctrl = ctrl.mech_control 435 file_ctrl.add_file(pseudo_image, filename='my_acceptance_letter.jpg') 436 self.browser.getControl(name='upload_acceptance_letter').click() 437 self.assertFalse( 438 '<a target="image" href="acceptance_letter.jpg">' 439 in self.browser.contents) 440 ctrl = self.browser.getControl(name='acceptance_letter') 441 file_ctrl = ctrl.mech_control 442 file_ctrl.add_file(pseudo_image, filename='my_acceptance_letter.jpg') 443 self.browser.getControl(name='upload_acceptance_letter').click() 444 self.assertTrue( 445 '<a target="image" href="acceptance_letter.jpg">' 446 in self.browser.contents) 447 self.browser.getControl(name='delete_acceptance_letter').click() 448 self.assertTrue( 449 'File acceptance_letter.jpg deleted' 429 450 in self.browser.contents) 430 451
Note: See TracChangeset for help on using the changeset viewer.