- Timestamp:
- 4 Jun 2013, 16:16:24 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.futminna/trunk/src/waeup/futminna/applicants/tests/test_browser.py
r10224 r10275 252 252 self.assertTrue(fd is None) 253 253 254 def test_upload_credential form_by_manager(self):254 def test_upload_credentials_by_manager(self): 255 255 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 256 256 self.browser.open(self.manage_path) … … 258 258 pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 259 259 pseudo_pdf = StringIO(pdf_content) 260 # This is a ug applicant, thus the credential formis not260 # This is a ug applicant, thus the credentials is not 261 261 # required 262 self.assertFalse('credential form">' in self.browser.contents)262 self.assertFalse('credentials">' in self.browser.contents) 263 263 264 264 # We have to add a pg applicants container … … 288 288 289 289 self.browser.open(self.manage_path_pg) 290 ctrl = self.browser.getControl(name='form.credential form')291 file_ctrl = ctrl.mech_control 292 file_ctrl.add_file(pseudo_pdf, filename='myform.pdf') 293 self.browser.getControl("Save").click() # submit form 294 # Even though the form could not be saved ... 295 self.assertTrue('Required input is missing' in self.browser.contents) 296 # ... the file has been successfully uploaded 297 pdf_url = self.manage_path_pg.replace('manage', 'credential form.pdf')290 ctrl = self.browser.getControl(name='form.credentials') 291 file_ctrl = ctrl.mech_control 292 file_ctrl.add_file(pseudo_pdf, filename='myform.pdf') 293 self.browser.getControl("Save").click() # submit form 294 # Even though the form could not be saved ... 295 self.assertTrue('Required input is missing' in self.browser.contents) 296 # ... the file has been successfully uploaded 297 pdf_url = self.manage_path_pg.replace('manage', 'credentials.pdf') 298 298 self.browser.open(pdf_url) 299 299 self.assertEqual( … … 303 303 storage = getUtility(IExtFileStore) 304 304 file_id = IFileStoreNameChooser(applicant).chooseName( 305 attr='credential form.pdf')305 attr='credentials.pdf') 306 306 # The stored file can be fetched 307 307 fd = storage.getFile(file_id) … … 310 310 # A file link is displayed on the edit view ... 311 311 self.browser.open(self.manage_path_pg) 312 self.assertTrue('<a href="credential form.pdf">' in self.browser.contents)312 self.assertTrue('<a href="credentials.pdf">' in self.browser.contents) 313 313 # ... and on the dislay view 314 314 self.browser.open(self.view_path_pg) 315 self.assertTrue('<a href="credential form.pdf">Credential Form</a>'315 self.assertTrue('<a href="credentials.pdf">Credentials</a>' 316 316 in self.browser.contents) 317 317 # Adding file is properly logged … … 321 321 self.assertTrue( 322 322 'zope.mgr - waeup.futminna.applicants.browser.CustomApplicantManageFormPage' 323 ' - %s - saved: credential form'323 ' - %s - saved: credentials' 324 324 % (applicant.applicant_id) 325 325 in logcontent)
Note: See TracChangeset for help on using the changeset viewer.