Changeset 11986
- Timestamp:
- 19 Nov 2014, 06:42:39 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r11985 r11986 50 50 51 51 grok.context(IIkobaObject) 52 53 54 # Save function used for save methods in pages 55 def msave(view, **data): 56 changed_fields = view.applyData(view.context, **data) 57 # Turn list of lists into single list 58 if changed_fields: 59 changed_fields = reduce(lambda x,y: x+y, changed_fields.values()) 60 fields_string = ' + '.join(changed_fields) 61 view.flash(_('Form has been saved.')) 62 if fields_string: 63 view.context.writeLogMessage(view, 'saved: %s' % fields_string) 64 return 65 66 67 def emit_lock_message(view): 68 """Flash a lock message. 69 """ 70 view.flash(_('The requested form is locked (read-only).'), type="warning") 71 view.redirect(view.url(view.context)) 72 return 52 73 53 74 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r11978 r11986 555 555 '...You logged in...', self.browser.contents) 556 556 # Admitted customer can upload a passport picture 557 self.browser. open(self.customer_path + '/change_portrait')557 self.browser.getLink("Change portrait").click() 558 558 ctrl = self.browser.getControl(name='passportuploadedit') 559 559 file_obj = open(SAMPLE_IMAGE, 'rb') … … 565 565 'src="http://localhost/app/customers/K1000000/passport.jpg"' 566 566 in self.browser.contents) 567 568 def test_customer_baseedit(self): 569 # Customers can change the password 570 self.customer.personal_updated = datetime.utcnow() 571 self.browser.open(self.login_path) 572 self.browser.getControl(name="form.login").value = self.customer_id 573 self.browser.getControl(name="form.password").value = 'spwd' 574 self.browser.getControl("Login").click() 575 self.assertEqual(self.browser.url, self.customer_path) 576 self.assertTrue('You logged in' in self.browser.contents) 577 self.browser.getLink("Edit").click() 578 self.browser.getControl(name="form.email").value = 'new_email@aa.ng' 579 self.browser.getControl("Save").click() 580 self.assertMatches('...Form has been saved...', 581 self.browser.contents) 582 # Customer can view history 583 self.browser.getLink("History").click() 584 self.assertMatches('...Customer record created by system...', 585 self.browser.contents) 567 586 568 587 def test_customer_login(self): -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py
r11985 r11986 252 252 253 253 254 class CustomerBaseActionButton(ManageActionButton): 255 grok.order(1) 256 grok.context(ICustomer) 257 grok.view(CustomerBaseDisplayFormPage) 258 grok.require('waeup.handleCustomer') 259 text = _('Edit') 260 target = 'edit_base' 261 254 262 class CustomerPasswordActionButton(ManageActionButton): 255 263 grok.order(2) … … 260 268 text = _('Change password') 261 269 target = 'changepassword' 270 271 class CustomerPassportActionButton(ManageActionButton): 272 grok.order(3) 273 grok.context(ICustomer) 274 grok.view(CustomerBaseDisplayFormPage) 275 grok.require('waeup.handleCustomer') 276 icon = 'actionicon_portrait.png' 277 text = _('Change portrait') 278 target = 'change_portrait'
Note: See TracChangeset for help on using the changeset viewer.