Changeset 7123 for main/waeup.sirp/trunk/src/waeup/sirp/students/tests
- Timestamp:
- 17 Nov 2011, 07:42:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7122 r7123 364 364 # No birth certificate has been uploaded yet 365 365 # Browsing the link shows a placerholder image 366 self.browser.open('birth_certificate .jpg')366 self.browser.open('birth_certificate') 367 367 self.assertEqual( 368 368 self.browser.headers['content-type'], 'image/jpeg') … … 378 378 self.browser.getControl("Save (no upload)").click() # submit form 379 379 self.assertFalse( 380 '<a target="image" href="birth_certificate .jpg">'380 '<a target="image" href="birth_certificate">' 381 381 in self.browser.contents) 382 382 # ... but the correct upload submit button does … … 389 389 # There is a correct <img> link included 390 390 self.assertTrue( 391 '<a target="image" href="birth_certificate .jpg">'391 '<a target="image" href="birth_certificate">' 392 392 in self.browser.contents) 393 393 394 394 # Browsing the link shows a real image 395 self.browser.open('birth_certificate .jpg')395 self.browser.open('birth_certificate') 396 396 self.assertEqual( 397 397 self.browser.headers['content-type'], 'image/jpeg') … … 428 428 self.browser.getControl( 429 429 name='upload_birthcertificateuploadmanage').click() 430 self.assertTrue('.jpg file extension expected' in self.browser.contents) 430 self.assertTrue('Only the following extension are allowed' 431 in self.browser.contents) 431 432 # Managers can delete files 432 433 self.browser.getControl(name='delete_birthcertificateuploadmanage').click() 433 434 self.assertTrue( 434 'File birth_certificate.jpg deleted' 435 in self.browser.contents) 435 'birth_certificate deleted' in self.browser.contents) 436 436 # Managers can add and delete second file 437 437 self.browser.open(self.edit_clearance_student_path) … … 443 443 name='upload_acceptanceletteruploadmanage').click() 444 444 self.assertFalse( 445 '<a target="image" href="acceptance_letter .jpg">'445 '<a target="image" href="acceptance_letter">' 446 446 in self.browser.contents) 447 447 ctrl = self.browser.getControl(name='acceptanceletteruploadmanage') … … 451 451 name='upload_acceptanceletteruploadmanage').click() 452 452 self.assertTrue( 453 '<a target="image" href="acceptance_letter .jpg">'453 '<a target="image" href="acceptance_letter">' 454 454 in self.browser.contents) 455 455 self.browser.getControl( 456 456 name='delete_acceptanceletteruploadmanage').click() 457 457 self.assertTrue( 458 'File acceptance_letter.jpg deleted' 458 'acceptance_letter deleted' 459 in self.browser.contents) 460 # Managers can upload a file via the StudentBaseManageFormPage 461 self.browser.open(self.manage_student_path) 462 pseudo_image = StringIO('I pretend to be a graphics file') 463 ctrl = self.browser.getControl(name='passportuploadmanage') 464 file_ctrl = ctrl.mech_control 465 file_ctrl.add_file(pseudo_image, filename='my_photo.bmp') 466 self.browser.getControl( 467 name='upload_passportuploadmanage').click() 468 self.assertTrue('jpg file extension expected' 469 in self.browser.contents) 470 ctrl = self.browser.getControl(name='passportuploadmanage') 471 file_ctrl = ctrl.mech_control 472 file_ctrl.add_file(pseudo_image, filename='my_photo.jpg') 473 self.browser.getControl( 474 name='upload_passportuploadmanage').click() 475 self.assertTrue( 476 '<img align="middle" height="125px" src="passport.jpg" />' 459 477 in self.browser.contents) 460 478
Note: See TracChangeset for help on using the changeset viewer.