-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] project: write tests subtasks unlinking/portal create user
Task-3460027 closes odoo#135266 Signed-off-by: Xavier Bol (xbo) <[email protected]>
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ def setUpClass(cls): | |
Command.link(cls.partner_portal.id), | ||
], | ||
}) | ||
project_share_wizard.action_send_mail() | ||
project_share_wizard.action_share_record() | ||
|
||
Task = cls.env['project.task'] | ||
cls.read_protected_fields_task = OrderedDict([ | ||
|
@@ -76,3 +76,31 @@ def test_write_with_portal_user(self): | |
for field in self.other_fields_task: | ||
with self.assertRaises(AccessError): | ||
self.task_portal.with_user(self.user_portal).write({field: 'dummy'}) | ||
|
||
def test_wizard_confirm(self): | ||
partner_portal_no_user = self.env['res.partner'].create({ | ||
'name': 'NoUser portal', | ||
'email': '[email protected]', | ||
'company_id': False, | ||
'user_ids': [], | ||
}) | ||
|
||
project_share_wizard_no_user = self.env['project.share.wizard'].create({ | ||
'access_mode': 'edit', | ||
'res_model': 'project.project', | ||
'res_id': self.project_portal.id, | ||
'partner_ids': [ | ||
Command.link(partner_portal_no_user.id), | ||
], | ||
}) | ||
self.env["res.config.settings"].create({"auth_signup_uninvited": 'b2b'}).execute() | ||
|
||
project_share_wizard_no_user_action = project_share_wizard_no_user.action_share_record() | ||
self.assertEqual(project_share_wizard_no_user_action['type'], 'ir.actions.act_window', 'Sharing a project with partner without user should display a confimation dialog') | ||
project_share_wizard_confirmation = self.env['project.share.wizard'].browse(project_share_wizard_no_user_action['res_id']) | ||
|
||
project_share_wizard_confirmation.action_send_mail() | ||
mail_partner = self.env['mail.message'].search([('partner_ids', '=', partner_portal_no_user.id)], limit=1) | ||
self.assertTrue(mail_partner, 'A mail should have been sent to the non portal user') | ||
self.assertIn('href="http://localhost:8069/web/signup', str(mail_partner.body), 'The message link should contain the url to register to the portal') | ||
self.assertIn('token=', str(mail_partner.body), 'The message link should contain a personalized token to register to the portal') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters