diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-08-26 07:57:36 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-08-27 14:29:56 +0000 |
| commit | 910559c092dc7dfa00b91339a5423e16cd4668e1 (patch) | |
| tree | cc333e7560d729de67949eb374ba67b221941a9b /addons/crm_iap_lead_enrich | |
| parent | f5df1ed912455e5ed52a65df3149f30a9d424de0 (diff) | |
[REF] various: use helper to create tests users
PURPOSE
Lessen use of mail-specific calls and variables
SPECIFICATIONS
Use mail_new_test_user tool in tests, lessening use of mail-specific context
keys in tests.
LINKS
Task ID-2326281 (context keys use cleaning)
PR odoo/odoo#56631
PR odoo/enterprise#12707
Diffstat (limited to 'addons/crm_iap_lead_enrich')
| -rw-r--r-- | addons/crm_iap_lead_enrich/tests/common.py | 15 | ||||
| -rw-r--r-- | addons/crm_iap_lead_enrich/tests/test_lead_enrich.py | 9 |
2 files changed, 6 insertions, 18 deletions
diff --git a/addons/crm_iap_lead_enrich/tests/common.py b/addons/crm_iap_lead_enrich/tests/common.py index 38ed094f93f..fb4b40e4269 100644 --- a/addons/crm_iap_lead_enrich/tests/common.py +++ b/addons/crm_iap_lead_enrich/tests/common.py @@ -7,9 +7,7 @@ from unittest.mock import patch from odoo import exceptions from odoo.addons.iap.tools import iap_tools from odoo.addons.crm_iap_lead_enrich.models.iap_enrich_api import IapEnrichAPI -from odoo.tests import common, new_test_user - -crm_new_test_user = partial(new_test_user, context={'mail_create_nolog': True, 'mail_create_nosubscribe': True, 'mail_notrack': True, 'no_reset_password': True}) +from odoo.tests import common class MockIAPEnrich(common.BaseCase): @@ -51,14 +49,3 @@ class MockIAPEnrich(common.BaseCase): yield finally: pass - - -class CrmCase(common.SavepointCase): - - @classmethod - def setUpClass(cls): - super(CrmCase, cls).setUpClass() - - cls.sales_manager = crm_new_test_user( - cls.env, login='sales_manager', groups='base.group_user,sales_team.group_sale_manager', - name='Martine SalesManager', email='"Martine SalesManager" <martine@example.com>') diff --git a/addons/crm_iap_lead_enrich/tests/test_lead_enrich.py b/addons/crm_iap_lead_enrich/tests/test_lead_enrich.py index d8ddf38503a..413d872f6ed 100644 --- a/addons/crm_iap_lead_enrich/tests/test_lead_enrich.py +++ b/addons/crm_iap_lead_enrich/tests/test_lead_enrich.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo.addons.crm_iap_lead_enrich.tests import common as crm_iap_lead_enrich_common +from odoo.addons.crm.tests.common import TestCrmCommon +from odoo.addons.crm_iap_lead_enrich.tests.common import MockIAPEnrich from odoo.tests.common import users -class TestLeadEnrich(crm_iap_lead_enrich_common.CrmCase, crm_iap_lead_enrich_common.MockIAPEnrich): +class TestLeadEnrich(TestCrmCommon, MockIAPEnrich): @classmethod def setUpClass(cls): @@ -18,7 +19,7 @@ class TestLeadEnrich(crm_iap_lead_enrich_common.CrmCase, crm_iap_lead_enrich_com 'email_from': 'test_mail_%s@example.com' % x }) - @users('sales_manager') + @users('user_sales_manager') def test_enrich_internals(self): leads = self.env['crm.lead'].browse(self.leads.ids) leads[0].write({'partner_name': 'Already set', 'email_from': 'test@test1'}) @@ -41,7 +42,7 @@ class TestLeadEnrich(crm_iap_lead_enrich_common.CrmCase, crm_iap_lead_enrich_com # with self.mockIAPEnrichGateway(sim_error='credit'): # leads.iap_enrich() - @users('sales_manager') + @users('user_sales_manager') def test_enrich_error_jsonrpc_exception(self): leads = self.env['crm.lead'].browse(self.leads.ids) with self.mockIAPEnrichGateway(sim_error='jsonrpc_exception'): |
