Browse Source

[IMP] partner_password_reset: Changes per PR review

* Raise test coverage & simplify syntax
pull/383/head
Ted Salmon 8 years ago
parent
commit
e1fb8049d9
No known key found for this signature in database GPG Key ID: 1E92222DD9AF3435
  1. 10
      partner_password_reset/tests/test_res_partner_password_reset_wizard.py
  2. 3
      partner_password_reset/wizard/res_partner_password_reset_wizard.py

10
partner_password_reset/tests/test_res_partner_password_reset_wizard.py

@ -17,6 +17,16 @@ class TestResPartnerPasswordResetWizard(TransactionCase):
with self.assertRaises(Warning): with self.assertRaises(Warning):
wizard.fields_view_get() wizard.fields_view_get()
def test_fields_view_get(self):
""" It should return the wizard correctly """
partner = self.env.ref('portal.partner_demo_portal')
wizard = self.env['res.partner.password.reset.wizard'].with_context(
active_ids=partner.id
)
output = wizard.fields_view_get()
self.assertEquals(output.get('name'), 'Send Password Reset Email')
self.assertEquals(type(output.get('fields').get('user_ids')), dict)
def test_action_submit(self): def test_action_submit(self):
""" It should call user_ids.action_reset_password """ """ It should call user_ids.action_reset_password """
self.env['res.users']._patch_method( self.env['res.users']._patch_method(

3
partner_password_reset/wizard/res_partner_password_reset_wizard.py

@ -39,5 +39,4 @@ class ResPartnerPasswordResetWizard(models.TransientModel):
@api.multi @api.multi
def action_submit(self): def action_submit(self):
""" Reset the user passwords on submission """ """ Reset the user passwords on submission """
for rec in self:
rec.user_ids.action_reset_password()
self.mapped('user_ids').action_reset_password()
Loading…
Cancel
Save