Browse Source
[IMP] partner_password_reset: Changes per PR review
* Raise test coverage & simplify syntax
pull/383/head
Ted Salmon
8 years ago
No known key found for this signature in database
GPG Key ID: 1E92222DD9AF3435
2 changed files with
11 additions and
2 deletions
-
partner_password_reset/tests/test_res_partner_password_reset_wizard.py
-
partner_password_reset/wizard/res_partner_password_reset_wizard.py
|
|
@ -17,6 +17,16 @@ class TestResPartnerPasswordResetWizard(TransactionCase): |
|
|
|
with self.assertRaises(Warning): |
|
|
|
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): |
|
|
|
""" It should call user_ids.action_reset_password """ |
|
|
|
self.env['res.users']._patch_method( |
|
|
|
|
|
@ -39,5 +39,4 @@ class ResPartnerPasswordResetWizard(models.TransientModel): |
|
|
|
@api.multi |
|
|
|
def action_submit(self): |
|
|
|
""" Reset the user passwords on submission """ |
|
|
|
for rec in self: |
|
|
|
rec.user_ids.action_reset_password() |
|
|
|
self.mapped('user_ids').action_reset_password() |