[REF] mail: move channel tests to discuss folder
Part of task-3265211 closes odoo/odoo#120062 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -2,9 +2,6 @@
|
||||
|
||||
from . import test_get_model_definitions
|
||||
from . import test_link_preview
|
||||
from . import test_discuss_channel
|
||||
from . import test_discuss_channel_as_guest
|
||||
from . import test_discuss_channel_member
|
||||
from . import test_mail_composer
|
||||
from . import test_mail_full_composer
|
||||
from . import test_mail_render
|
||||
@@ -14,7 +11,7 @@ from . import test_notify_security_update
|
||||
from . import test_res_partner
|
||||
from . import test_res_users
|
||||
from . import test_res_users_settings
|
||||
from . import test_rtc
|
||||
from . import test_uninstall
|
||||
from . import test_update_notification
|
||||
from . import test_user_modify_own_profile
|
||||
from . import discuss
|
||||
|
||||
@@ -960,7 +960,6 @@ class MailCase(MockEmail):
|
||||
|
||||
EXPECTED
|
||||
:param channels: list of expected bus channels, like [
|
||||
(self.cr.dbname, 'discuss.channel', self.channel_1.id),
|
||||
(self.cr.dbname, 'res.partner', self.partner_employee_2.id)
|
||||
]
|
||||
:param message_items: if given, list of expected message making a valid
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_discuss_channel
|
||||
from . import test_discuss_channel_as_guest
|
||||
from . import test_discuss_channel_member
|
||||
from . import test_rtc
|
||||
+2
-2
@@ -20,7 +20,7 @@ class TestChannelAccessRights(MailCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestChannelAccessRights, cls).setUpClass()
|
||||
super().setUpClass()
|
||||
|
||||
cls.user_employee_1 = mail_new_test_user(cls.env, login='user_employee_1', groups='base.group_user', name='Tao Lee')
|
||||
cls.user_public = mail_new_test_user(cls.env, login='user_public', groups='base.group_public', name='Bert Tartignole')
|
||||
@@ -217,7 +217,7 @@ class TestChannelInternals(MailCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestChannelInternals, cls).setUpClass()
|
||||
super().setUpClass()
|
||||
cls.test_channel = cls.env['discuss.channel'].browse(cls.env['discuss.channel'].with_context(cls._test_context).channel_create(name='Channel', group_id=None)['id'])
|
||||
cls.test_partner = cls.env['res.partner'].with_context(cls._test_context).create({
|
||||
'name': 'Test Partner',
|
||||
+1
-1
@@ -14,7 +14,7 @@ class TestDiscussChannelMembers(MailCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestDiscussChannelMembers, cls).setUpClass()
|
||||
super().setUpClass()
|
||||
|
||||
cls.secret_group = cls.env['res.groups'].create({
|
||||
'name': 'Secret User Group',
|
||||
@@ -41,11 +41,7 @@ class TestLinkPreview(MailCommon):
|
||||
name='User 1',
|
||||
groups='base.group_user')
|
||||
|
||||
cls.public_channel = cls.env['discuss.channel'].create({
|
||||
'name': 'Public channel of user 1',
|
||||
'channel_type': 'channel',
|
||||
})
|
||||
cls.public_channel.channel_member_ids.unlink()
|
||||
cls.thread = cls.env['res.partner'].create({'name': 'a partner'})
|
||||
|
||||
def test_01_link_preview_throttle(self):
|
||||
with patch.object(requests.Session, 'get', _patched_get_html), patch.object(requests.Session, 'head', _patch_head_html):
|
||||
@@ -55,8 +51,8 @@ class TestLinkPreview(MailCommon):
|
||||
link_previews.append({'source_url': 'https://thisdomainedoentexist.nothing', 'message_id': 1})
|
||||
self.env['mail.link.preview'].create(link_previews)
|
||||
message = self.env['mail.message'].create({
|
||||
'model': 'discuss.channel',
|
||||
'res_id': self.public_channel.id,
|
||||
'model': self.thread._name,
|
||||
'res_id': self.thread.id,
|
||||
'body': '<a href="https://thisdomainedoentexist.nothing">Nothing link</a>',
|
||||
})
|
||||
self.env['mail.link.preview']._create_link_previews(message)
|
||||
@@ -66,13 +62,13 @@ class TestLinkPreview(MailCommon):
|
||||
def test_02_link_preview_create(self):
|
||||
with patch.object(requests.Session, 'get', _patched_get_html), patch.object(requests.Session, 'head', _patch_head_html):
|
||||
message = self.env['mail.message'].create({
|
||||
'model': 'discuss.channel',
|
||||
'res_id': self.public_channel.id,
|
||||
'model': self.thread._name,
|
||||
'res_id': self.thread.id,
|
||||
'body': '<a href="https://thisdomainedoentexist.nothing">Nothing link</a>',
|
||||
})
|
||||
self.env['mail.link.preview']._create_link_previews(message)
|
||||
self.assertBusNotifications(
|
||||
[(self.cr.dbname, 'discuss.channel', self.public_channel.id)],
|
||||
[(self.cr.dbname, 'res.partner', self.env.user.partner_id.id)],
|
||||
message_items=[{
|
||||
'type': 'mail.record/insert',
|
||||
'payload': {
|
||||
|
||||
Reference in New Issue
Block a user