Changeset 6595 for main/waeup.sirp/trunk/src
- Timestamp:
- 12 Aug 2011, 09:55:17 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py
r6478 r6595 106 106 if self.context.passport is not None: 107 107 return self.context.passport 108 return default_passport_image(self.context)109 108 return 110 109 -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6582 r6595 507 507 applicant_object = get_applicant_data(access_code) 508 508 return absoluteURL(applicant_object, self.request) + self.target 509 else:510 return ''509 #else: 510 # return '' 511 511 512 512 class AccessCodeEditLink(AccessCodeViewLink): … … 527 527 return '' 528 528 return absoluteURL(applicant_object, self.request) + self.target 529 else:530 return ''529 #else: 530 # return '' 531 531 532 532 class AccessCodeSlipLink(AccessCodeViewLink): … … 769 769 def update(self): 770 770 if self.context.locked: 771 #import pdb; pdb.set_trace() 771 772 self.emitLockMessage() 772 773 return … … 778 779 if not self.request.form.get('confirm_passport', False): 779 780 return 'Passport confirmation box not ticked.' 780 if len(self.errors) > 0:781 return 'Form has errors.'781 #if len(self.errors) > 0: 782 # return 'Form has errors.' 782 783 return False 783 784 784 785 @grok.action('Save') 785 786 def save(self, **data): 786 if self.context.locked:787 self.emitLockMessage()788 return787 #if self.context.locked: 788 # self.emitLockMessage() 789 # return 789 790 self.applyData(self.context, **data) 790 791 self.context._p_changed = True … … 794 795 @grok.action('Final Submit') 795 796 def finalsubmit(self, **data): 796 if self.context.locked:797 self.emitLockMessage()798 return797 #if self.context.locked: 798 # self.emitLockMessage() 799 # return 799 800 self.applyData(self.context, **data) 800 801 self.context._p_changed = True -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
r6591 r6595 30 30 from zope.component.hooks import setSite, clearSite 31 31 from zope.testbrowser.testing import Browser 32 from hurry.workflow.interfaces import IWorkflowInfo 32 33 from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase 33 34 from waeup.sirp.app import University … … 221 222 self.browser.getControl("Add applicants container").click() 222 223 self.assertTrue('Added:' in self.browser.contents) 224 self.browser.open(self.add_container_path) 225 self.browser.getControl("Cancel").click() 226 self.assertEqual(self.browser.url, self.manage_root_path + '#tab-1') 223 227 self.browser.open(self.add_container_path) 224 228 self.browser.getControl(name="form.prefix").value = ['app'] … … 235 239 self.browser.getControl("Remove selected", index=0).click() 236 240 self.assertTrue('Successfully removed:' in self.browser.contents) 241 self.browser.open(self.add_container_path) 242 self.browser.getControl(name="form.prefix").value = ['app'] 243 self.browser.getControl(name="form.year").value = ['2010'] 244 self.browser.getControl(name="form.provider").value = [ 245 'waeup.sirp.applicants.ApplicantsContainer'] 246 self.browser.getControl(name="form.ac_prefix").value = ['APP'] 247 self.browser.getControl(name="form.application_category").value = ['basic'] 248 self.browser.getControl("Add applicants container").click() 249 del self.app['applicants']['app2010'] 250 ctrl = self.browser.getControl(name='val_id') 251 ctrl.getControl(value='app2010').selected = True 252 self.browser.getControl("Remove selected", index=0).click() 253 self.assertMatches('...Could not delete...', self.browser.contents) 237 254 return 238 255 … … 261 278 self.browser.getControl("Remove selected", index=0).click() 262 279 self.assertTrue('Successfully removed:' in self.browser.contents) 280 self.browser.open(self.add_applicant_path) 281 existing_pin = self.pins[2] 282 parts = existing_pin.split('-')[1:] 283 existing_series, existing_number = parts 284 self.browser.getControl(name="form.ac_series").value = existing_series 285 self.browser.getControl(name="form.ac_number").value = existing_number 286 self.browser.getControl("Create application record").click() 287 self.assertTrue('Application initialized' in self.browser.contents) 288 self.browser.open(self.container_manage_path) 289 self.assertTrue(existing_pin in self.browser.contents) 290 del self.app['applicants']['app2009'][existing_pin] 291 ctrl = self.browser.getControl(name='val_id') 292 ctrl.getControl(value=existing_pin).selected = True 293 self.browser.getControl("Remove selected", index=0).click() 294 self.assertMatches('...Could not delete...', self.browser.contents) 263 295 return 264 296 … … 272 304 self.browser.open(self.applicant_manage_path) 273 305 self.assertEqual(self.browser.headers['Status'], '200 Ok') 306 self.browser.getControl(name="form.email").value = 'abc' 307 self.browser.getControl("Save").click() 308 self.assertMatches('...Invalid email address...', self.browser.contents) 309 self.browser.getControl(name="form.email").value = 'abc@def.gh' 274 310 self.browser.getControl(name="form.firstname").value = 'John' 275 311 self.browser.getControl(name="form.lastname").value = 'Tester' … … 288 324 self.assertEqual(self.browser.headers['Status'], '200 Ok') 289 325 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 326 self.browser.open(self.applicant_manage_path) 327 self.browser.getControl(name="form.course_admitted").value = [] 328 self.browser.getControl("Save").click() 329 self.browser.open(self.applicant_slip_path) 330 self.assertEqual(self.browser.headers['Status'], '200 Ok') 331 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 290 332 return 291 333 … … 318 360 ac_number.value = existing_number 319 361 self.browser.getControl(name="SUBMIT").click() 320 321 362 pin = self.pins[2] 322 363 appl = self.getRootFolder()['app']['applicants']['app2009'] … … 326 367 passp_len = len(passp.file.read()) 327 368 self.assertEqual(passp_len, PH_LEN) 328 329 330 369 #image_url = "%s/%s" % (self.browser.url, 'placeholder.jpg') 331 370 image_url = "%s/%s" % (self.browser.url, 'passport.jpg') … … 334 373 self.assertEqual(self.browser.headers['status'], '200 Ok') 335 374 self.assertEqual(self.browser.headers['content-type'], 'image/jpeg') 336 337 338 375 self.assertTrue('JFIF' in self.browser.contents) 339 376 self.assertEqual( … … 745 782 'Passport confirmation box not ticked' in self.browser.contents) 746 783 self.browser.getControl(name="confirm_passport").value = True 784 IWorkflowInfo(self.applicant).fireTransition('submit') 747 785 self.browser.getControl("Final Submit").click() # submit form again 748 786 self.assertTrue( 787 'Wrong state' in self.browser.contents) 788 IWorkflowInfo(self.applicant).fireTransition('reset1') 789 # Now do the whole thing again but with correct state 790 self.login() 791 self.fill_correct_values() 792 pseudo_image = StringIO('I pretend to be a graphics file') 793 ctrl = self.browser.getControl(name='form.passport') 794 file_ctrl = ctrl.mech_control 795 file_ctrl.add_file(pseudo_image, filename='myphoto.jpg') 796 self.browser.getControl(name="confirm_passport").value = True 797 self.browser.getControl("Final Submit").click() 798 self.assertTrue( 749 799 '... submitted ...' in self.browser.contents) 800 self.browser.goBack(count=1) 801 self.browser.getControl("Save").click() 802 self.assertTrue( 803 'The requested form is locked' in self.browser.contents) 804 self.browser.goBack(count=1) 805 #import pdb; pdb.set_trace() 806 self.browser.getControl("Final Submit").click() 807 self.assertTrue( 808 'The requested form is locked' in self.browser.contents) 750 809 return 751 810
Note: See TracChangeset for help on using the changeset viewer.