'Finding the partner based on email, based on partner / user / follower'

@mute_logger('odoo.addons.mail.models.mail_thread', 'odoo.models')
def test_message_process_partner_find(self):

    from_1 = self.env['res.partner'].create({'name': 'A', 'email': 'from.test@example.com'})
    self.format_and_process(MAIL_TEMPLATE, to='public@example.com', msg_id='<1>', email_from='Brice    Denisse    <from.test@example.com>')
    self.assertEqual(self.group_public.message_ids[0].author_id, from_1, 'message_process:    email_from    ->    author_id    wrong')
    self.group_public.message_unsubscribe([from_1.id])
    from_2 = self.env['res.users'].with_context({'no_reset_password': True}).create({'name': 'B', 'login': 'B', 'email': 'from.test@example.com'})
    self.format_and_process(MAIL_TEMPLATE, to='public@example.com', msg_id='<2>', email_from='Brice    Denisse    <from.test@example.com>')
    self.assertEqual(self.group_public.message_ids[0].author_id, from_2.partner_id, 'message_process:    email_from    ->    author_id    wrong')
    self.group_public.message_unsubscribe([from_2.partner_id.id])
    from_3 = self.env['res.partner'].create({'name': 'C', 'email': 'from.test@example.com'})
    self.group_public.message_subscribe([from_3.id])
    self.format_and_process(MAIL_TEMPLATE, to='public@example.com', msg_id='<3>', email_from='Brice    Denisse    <from.test@example.com>')
    self.assertEqual(self.group_public.message_ids[0].author_id, from_3, 'message_process:    email_from    ->    author_id    wrong')
