Changeset 7110 for main/waeup.sirp/trunk/src/waeup/sirp/students
- Timestamp:
- 14 Nov 2011, 11:03:00 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7109 r7110 362 362 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 363 363 self.browser.open(self.edit_clearance_student_path) 364 # No birth certificate has been uploaded yet 365 # Browsing the link shows a placerholder image 366 self.browser.open('birth_certificate.jpg') 367 self.assertEqual( 368 self.browser.headers['content-type'], 'image/jpeg') 369 self.assertEqual(len(self.browser.contents), PH_LEN) 364 370 # Create a pseudo image file and select it to be uploaded in form 365 371 # as birth certificate 372 self.browser.open(self.edit_clearance_student_path) 366 373 pseudo_image = StringIO('I pretend to be a graphics file') 367 374 ctrl = self.browser.getControl(name='birth_certificate') … … 371 378 self.browser.getControl("Save (no upload)").click() # submit form 372 379 self.assertFalse( 373 '<a target="image" href="birth_certificate.jpg">' in self.browser.contents) 380 '<a target="image" href="birth_certificate.jpg">' 381 in self.browser.contents) 374 382 # ... but the Upload submit button does 375 383 pseudo_image = StringIO('I pretend to be a graphics file') … … 397 405 self.assertTrue( 398 406 'Uploaded file is too big' in self.browser.contents) 407 # File names must meet several conditions 408 pseudo_image = StringIO('I pretend to be a graphics file') 409 ctrl = self.browser.getControl(name='birth_certificate') 410 file_ctrl = ctrl.mech_control 411 file_ctrl.add_file(pseudo_image, filename='my.photo.jpg') 412 self.browser.getControl("Upload").click() 413 self.assertTrue('File name contains more than one dot' 414 in self.browser.contents) 415 ctrl = self.browser.getControl(name='birth_certificate') 416 file_ctrl = ctrl.mech_control 417 file_ctrl.add_file(pseudo_image, filename='myphoto') 418 self.browser.getControl("Upload").click() 419 self.assertTrue('File name has no extension' in self.browser.contents) 420 ctrl = self.browser.getControl(name='birth_certificate') 421 file_ctrl = ctrl.mech_control 422 file_ctrl.add_file(pseudo_image, filename='myphoto.bmp') 423 self.browser.getControl("Upload").click() 424 self.assertTrue('.jpg file extension expected' in self.browser.contents) 425 # Managers can delete files 426 self.browser.getControl("Delete").click() 427 self.assertTrue( 428 'File birth_certificate.jpg deleted' 429 in self.browser.contents) 399 430 400 431 def test_manage_course_lists(self): … … 406 437 self.browser.getLink("Manage").click() 407 438 self.assertTrue('Manage study course' in self.browser.contents) 408 # Before we can select a level, the certificate must be selected and saved 439 # Before we can select a level, the certificate must 440 # be selected and saved 409 441 self.browser.getControl(name="form.certificate").value = ['CERT1'] 410 442 self.browser.getControl(name="form.current_session").value = ['2004'] … … 422 454 self.assertMatches('...This level exists...', self.browser.contents) 423 455 self.browser.getControl("Remove selected").click() 424 self.assertMatches('...No study level selected...', self.browser.contents) 456 self.assertMatches( 457 '...No study level selected...', self.browser.contents) 425 458 self.browser.getControl(name="val_id").value = ['100'] 426 459 self.browser.getControl("Remove selected").click() … … 433 466 # Managers can view and manage course lists 434 467 self.browser.getLink("100").click() 435 self.assertMatches('...: Study Level 100 (Year 1)...', self.browser.contents) 468 self.assertMatches( 469 '...: Study Level 100 (Year 1)...', self.browser.contents) 436 470 self.browser.getLink("Manage").click() 437 471 self.browser.getControl(name="form.level_session").value = ['2002'] … … 476 510 self.browser.getControl(name="transition").value = ['clear'] 477 511 self.browser.getControl("Save").click() 478 self.browser.getControl(name="transition").value = ['pay_first_school_fee'] 512 self.browser.getControl( 513 name="transition").value = ['pay_first_school_fee'] 479 514 self.browser.getControl("Save").click() 480 515 self.browser.getControl(name="transition").value = ['reset6'] -
main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py
r7108 r7110 92 92 link = 'index' 93 93 text = u'Base Data' 94 95 @property96 def alt(self):97 """Alternative text for icon.98 """99 return self.text100 94 101 95 @property
Note: See TracChangeset for help on using the changeset viewer.