<commit_before># -*- coding: utf8 -*-
#
# Copyright (C) 2014 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from openerp.tests import common

class TestMailNoAutofollow(common.TransactionCase):

    def setUp(self):
        super(TestMailNoAutofollow, self).setUp()
        self.partner_id = self.ref('base.res_partner_1')
        self.user_id = self.ref('base.user_demo_res_partner')

    def test_10_post_no_autofollow(self):
        """Check that only users are subscribed."""
        mt_object = self.env['mail.thread'].create({
            'name': "Mail Thread",
        })
        wizard = self.env['mail.compose.message'].create({
            'partner_ids': [(6, 0, [self.partner_id, self.user_id])],
            'subject': "Test email",
            'body': "This is a test email",
            'model': 'mail.thread',
            'res_id': mt_object.id,
        })
        wizard.with_context(mail_post_autofollow=True).send_mail()
        self.assertIn(self.user_id, mt_object.message_follower_ids.ids)
        self.assertNotIn(self.partner_id, mt_object.message_follower_ids.ids)<commit_msg>[FIX] Removed unknown name field in tests (mail_no_autofollow)<commit_after># -*- coding: utf8 -*-
#
# Copyright (C) 2014 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

from openerp.tests import common

class TestMailNoAutofollow(common.TransactionCase):

    def setUp(self):
        super(TestMailNoAutofollow, self).setUp()
        self.partner_id = self.ref('base.res_partner_1')
        self.user_id = self.ref('base.user_demo_res_partner')

    def test_10_post_no_autofollow(self):
        """Check that only users are subscribed."""
        mt_object = self.env['mail.thread'].create({})
        wizard = self.env['mail.compose.message'].create({
            'partner_ids': [(6, 0, [self.partner_id, self.user_id])],
            'subject': "Test email",
            'body': "This is a test email",
            'model': 'mail.thread',
            'res_id': mt_object.id,
        })
        wizard.with_context(mail_post_autofollow=True).send_mail()
        self.assertIn(self.user_id, mt_object.message_follower_ids.ids)
        self.assertNotIn(self.partner_id, mt_object.message_follower_ids.ids)
{'fraction_non_alphanumeric': 0.10822873082287308, 'fraction_numerical': 0.006136680613668061, 'mean_word_length': 3.1123853211009176, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5390224', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1074, 'n_words': 329}