Changeset 7127 for main/waeup.sirp/trunk/src/waeup/sirp/students/tests
- Timestamp:
- 17 Nov 2011, 13:55:14 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7124 r7127 357 357 return 358 358 359 def test_ upload_file(self):359 def test_manage_upload_file(self): 360 360 # Managers can upload a file via the StudentClearanceManageFormPage 361 361 # The image is stored even if form has errors … … 372 372 self.browser.open(self.edit_clearance_student_path) 373 373 pseudo_image = StringIO('I pretend to be a graphics file') 374 ctrl = self.browser.getControl(name='birthcertificateupload manage')374 ctrl = self.browser.getControl(name='birthcertificateupload') 375 375 file_ctrl = ctrl.mech_control 376 376 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg') … … 382 382 # ... but the correct upload submit button does 383 383 pseudo_image = StringIO('I pretend to be a graphics file') 384 ctrl = self.browser.getControl(name='birthcertificateupload manage')384 ctrl = self.browser.getControl(name='birthcertificateupload') 385 385 file_ctrl = ctrl.mech_control 386 386 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg') 387 387 self.browser.getControl( 388 name='upload_birthcertificateupload manage').click()388 name='upload_birthcertificateupload').click() 389 389 # There is a correct <img> link included 390 390 self.assertTrue( … … 401 401 photo_content = 'A' * 1024 * 151 # A string of 21 KB size 402 402 pseudo_image = StringIO(photo_content) 403 ctrl = self.browser.getControl(name='birthcertificateupload manage')403 ctrl = self.browser.getControl(name='birthcertificateupload') 404 404 file_ctrl = ctrl.mech_control 405 405 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.jpg') 406 406 self.browser.getControl( 407 name='upload_birthcertificateupload manage').click()407 name='upload_birthcertificateupload').click() 408 408 self.assertTrue( 409 409 'Uploaded file is too big' in self.browser.contents) 410 410 # File names must meet several conditions 411 411 pseudo_image = StringIO('I pretend to be a graphics file') 412 ctrl = self.browser.getControl(name='birthcertificateupload manage')412 ctrl = self.browser.getControl(name='birthcertificateupload') 413 413 file_ctrl = ctrl.mech_control 414 414 file_ctrl.add_file(pseudo_image, filename='my.photo.jpg') 415 415 self.browser.getControl( 416 name='upload_birthcertificateupload manage').click()416 name='upload_birthcertificateupload').click() 417 417 self.assertTrue('File name contains more than one dot' 418 418 in self.browser.contents) 419 ctrl = self.browser.getControl(name='birthcertificateupload manage')419 ctrl = self.browser.getControl(name='birthcertificateupload') 420 420 file_ctrl = ctrl.mech_control 421 421 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate') 422 422 self.browser.getControl( 423 name='upload_birthcertificateupload manage').click()423 name='upload_birthcertificateupload').click() 424 424 self.assertTrue('File name has no extension' in self.browser.contents) 425 ctrl = self.browser.getControl(name='birthcertificateupload manage')425 ctrl = self.browser.getControl(name='birthcertificateupload') 426 426 file_ctrl = ctrl.mech_control 427 427 file_ctrl.add_file(pseudo_image, filename='my_birth_certificate.bmp') 428 428 self.browser.getControl( 429 name='upload_birthcertificateupload manage').click()429 name='upload_birthcertificateupload').click() 430 430 self.assertTrue('Only the following extension are allowed' 431 431 in self.browser.contents) 432 432 # Managers can delete files 433 self.browser.getControl(name='delete_birthcertificateupload manage').click()433 self.browser.getControl(name='delete_birthcertificateupload').click() 434 434 self.assertTrue( 435 435 'birth_certificate deleted' in self.browser.contents) … … 437 437 self.browser.open(self.edit_clearance_student_path) 438 438 pseudo_image = StringIO('I pretend to be a graphics file') 439 ctrl = self.browser.getControl(name='birthcertificateupload manage')439 ctrl = self.browser.getControl(name='birthcertificateupload') 440 440 file_ctrl = ctrl.mech_control 441 441 file_ctrl.add_file(pseudo_image, filename='my_acceptance_letter.jpg') 442 442 self.browser.getControl( 443 name='upload_acceptanceletterupload manage').click()443 name='upload_acceptanceletterupload').click() 444 444 self.assertFalse( 445 445 '<a target="image" href="acceptance_letter">' 446 446 in self.browser.contents) 447 ctrl = self.browser.getControl(name='acceptanceletterupload manage')447 ctrl = self.browser.getControl(name='acceptanceletterupload') 448 448 file_ctrl = ctrl.mech_control 449 449 file_ctrl.add_file(pseudo_image, filename='my_acceptance_letter.jpg') 450 450 self.browser.getControl( 451 name='upload_acceptanceletterupload manage').click()451 name='upload_acceptanceletterupload').click() 452 452 self.assertTrue( 453 453 '<a target="image" href="acceptance_letter">' 454 454 in self.browser.contents) 455 455 self.browser.getControl( 456 name='delete_acceptanceletterupload manage').click()456 name='delete_acceptanceletterupload').click() 457 457 self.assertTrue( 458 458 'acceptance_letter deleted' … … 738 738 self.browser.getControl(name="form.password").value = 'spwd' 739 739 self.browser.getControl("Login").click() 740 # Student can upload a passport picture 741 self.browser.open(self.student_path + '/change_portrait') 742 pseudo_image = StringIO('I pretend to be a graphics file') 743 ctrl = self.browser.getControl(name='passportuploadedit') 744 file_ctrl = ctrl.mech_control 745 file_ctrl.add_file(pseudo_image, filename='my_photo.jpg') 746 self.browser.getControl( 747 name='upload_passportuploadedit').click() 748 self.assertTrue( 749 '<img align="middle" height="125px" src="passport.jpg" />' 750 in self.browser.contents) 740 751 # Student can view the clearance data 741 752 self.browser.getLink("Clearance Data").click()
Note: See TracChangeset for help on using the changeset viewer.