[REF] test_mail_sms: simplify SMS-based test class usage

'TestSMSCommon' was useless and is replaced by the 'SMSCommon' class defined
directly in SMS addon, easing inheritance and imports. See community PR for
more details.

Task-3263512

Part-of: odoo/odoo#117606
This commit is contained in:
Thibault Delavallée
2023-04-04 20:08:37 +02:00
parent c9848bbf58
commit c7af3b7c09
10 changed files with 28 additions and 29 deletions
-7
View File
@@ -2,16 +2,9 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.phone_validation.tools import phone_validation
from odoo.addons.sms.tests.common import SMSCommon
from odoo.addons.mail.tests.common import MailCommon
from odoo.addons.test_mail.tests.common import TestRecipients
class TestSMSCommon(SMSCommon, MailCommon):
""" Main entry point for functional tests. It combines both SMS and MAIL
testing classes. """
class TestSMSRecipients(TestRecipients):
@classmethod
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon, TestSMSRecipients
from odoo.addons.sms.tests.common import SMSCommon
from odoo.addons.test_mail_sms.tests.common import TestSMSRecipients
from odoo.tests import tagged, users
@tagged('mail_thread')
class TestSMSActionsCommon(TestSMSCommon, TestSMSRecipients):
class TestSMSActionsCommon(SMSCommon, TestSMSRecipients):
""" Test mail.thread.phone mixin, its tools and API """
@classmethod
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon, TestSMSRecipients
from odoo.addons.sms.tests.common import SMSCommon
from odoo.addons.test_mail_sms.tests.common import TestSMSRecipients
class TestPhoneBlacklist(TestSMSCommon, TestSMSRecipients):
class TestPhoneBlacklist(SMSCommon, TestSMSRecipients):
""" Test phone blacklist management """
@classmethod
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon, TestSMSRecipients
from odoo.addons.sms.tests.common import SMSCommon
from odoo.addons.test_mail_sms.tests.common import TestSMSRecipients
class TestSMSComposerComment(TestSMSCommon, TestSMSRecipients):
class TestSMSComposerComment(SMSCommon, TestSMSRecipients):
""" TODO LIST
* add test for default_res_model / default_res_id and stuff like that;
@@ -251,7 +252,7 @@ class TestSMSComposerComment(TestSMSCommon, TestSMSRecipients):
self.assertSMSNotification([{'number': self.random_numbers_san[0]}], self._test_body)
class TestSMSComposerBatch(TestSMSCommon):
class TestSMSComposerBatch(SMSCommon):
@classmethod
def setUpClass(cls):
super(TestSMSComposerBatch, cls).setUpClass()
@@ -301,7 +302,7 @@ class TestSMSComposerBatch(TestSMSCommon):
)
class TestSMSComposerMass(TestSMSCommon):
class TestSMSComposerMass(SMSCommon):
@classmethod
def setUpClass(cls):
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon, TestSMSRecipients
from odoo.addons.sms.tests.common import SMSCommon
from odoo.addons.test_mail_sms.tests.common import TestSMSRecipients
from odoo.tests import tagged
from odoo.tools import mute_logger
class TestSMSActionsCommon(TestSMSCommon, TestSMSRecipients):
class TestSMSActionsCommon(SMSCommon, TestSMSRecipients):
@classmethod
def setUpClass(cls):
+5 -4
View File
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon, TestSMSRecipients
from odoo.addons.sms.tests.common import SMSCommon
from odoo.addons.test_mail_sms.tests.common import TestSMSRecipients
class TestSMSPost(TestSMSCommon, TestSMSRecipients):
class TestSMSPost(SMSCommon, TestSMSRecipients):
""" TODO
* add tests for new mail.message and mail.thread fields;
@@ -251,7 +252,7 @@ class TestSMSPost(TestSMSCommon, TestSMSRecipients):
self.assertSMSNotification([{'partner': self.partner_1, 'number': self.test_numbers_san[1]}], 'Dear %s this is an SMS.' % self.test_record.display_name, messages)
class TestSMSPostException(TestSMSCommon, TestSMSRecipients):
class TestSMSPostException(SMSCommon, TestSMSRecipients):
@classmethod
def setUpClass(cls):
@@ -392,7 +393,7 @@ class TestSMSPostException(TestSMSCommon, TestSMSRecipients):
], self._test_body, messages)
class TestSMSApi(TestSMSCommon):
class TestSMSApi(SMSCommon):
@classmethod
def setUpClass(cls):
@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon, TestSMSRecipients
from odoo.addons.sms.tests.common import SMSCommon
from odoo.addons.test_mail_sms.tests.common import TestSMSRecipients
from odoo.tests import tagged
from odoo.tools import mute_logger
@tagged('ir_actions')
class TestServerAction(TestSMSCommon, TestSMSRecipients):
class TestServerAction(SMSCommon, TestSMSRecipients):
@classmethod
def setUpClass(cls):
+2 -2
View File
@@ -7,12 +7,12 @@ from unittest.mock import DEFAULT
from odoo import exceptions
from odoo.addons.link_tracker.tests.common import MockLinkTracker
from odoo.addons.sms.models.sms_sms import SmsSms as SmsModel
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon
from odoo.addons.sms.tests.common import SMSCommon
from odoo.tests import tagged
@tagged('link_tracker')
class TestSMSPost(TestSMSCommon, MockLinkTracker):
class TestSMSPost(SMSCommon, MockLinkTracker):
@classmethod
def setUpClass(cls):
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon, TestSMSRecipients
from odoo.addons.sms.tests.common import SMSCommon
from odoo.addons.test_mail_sms.tests.common import TestSMSRecipients
class TestSmsTemplate(TestSMSCommon, TestSMSRecipients):
class TestSmsTemplate(SMSCommon, TestSMSRecipients):
@classmethod
def setUpClass(cls):
+1 -2
View File
@@ -4,10 +4,9 @@
from odoo.addons.phone_validation.tools import phone_validation
from odoo.addons.mass_mailing_sms.tests.common import MassSMSCommon
from odoo.addons.test_mail_sms.tests.common import TestSMSCommon
class TestMassMailCommon(MassSMSCommon, TestSMSCommon):
class TestMassMailCommon(MassSMSCommon):
@classmethod
def setUpClass(cls):