From 249bc45d6d6632f96809104afc14301096a0b9fb Mon Sep 17 00:00:00 2001 From: AaronHForgeFlow Date: Fri, 3 Jul 2020 14:00:51 +0200 Subject: [PATCH] [UPT]fetchmail_notify_error_to_sender remove dependency on test_mail --- .../__manifest__.py | 2 +- .../tests/__init__.py | 3 - .../test_fetchmail_notify_error_to_sender.py | 82 ------------------- 3 files changed, 1 insertion(+), 86 deletions(-) delete mode 100644 fetchmail_notify_error_to_sender/tests/__init__.py delete mode 100644 fetchmail_notify_error_to_sender/tests/test_fetchmail_notify_error_to_sender.py diff --git a/fetchmail_notify_error_to_sender/__manifest__.py b/fetchmail_notify_error_to_sender/__manifest__.py index 0061a9ec6..596c5bbe3 100644 --- a/fetchmail_notify_error_to_sender/__manifest__.py +++ b/fetchmail_notify_error_to_sender/__manifest__.py @@ -11,7 +11,7 @@ "author": "Agile Business Group,Eficent,Odoo Community Association (OCA)", "website": "https://github.com/OCA/server-tools", "license": "AGPL-3", - "depends": ["fetchmail", "test_mail"], + "depends": ["fetchmail"], "data": ["views/fetchmail_view.xml", "data/email_template_data.xml"], "qweb": [], "installable": True, diff --git a/fetchmail_notify_error_to_sender/tests/__init__.py b/fetchmail_notify_error_to_sender/tests/__init__.py deleted file mode 100644 index f6a213969..000000000 --- a/fetchmail_notify_error_to_sender/tests/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from . import test_fetchmail_notify_error_to_sender diff --git a/fetchmail_notify_error_to_sender/tests/test_fetchmail_notify_error_to_sender.py b/fetchmail_notify_error_to_sender/tests/test_fetchmail_notify_error_to_sender.py deleted file mode 100644 index aa762ddf8..000000000 --- a/fetchmail_notify_error_to_sender/tests/test_fetchmail_notify_error_to_sender.py +++ /dev/null @@ -1,82 +0,0 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -import socket -from email.utils import formataddr - -from odoo.tools import mute_logger - -from odoo.addons.test_mail.data.test_mail_data import MAIL_TEMPLATE -from odoo.addons.test_mail.tests.test_mail_gateway import TestMailgateway - - -class TestFetchmailNotifyErrorToSender(TestMailgateway): - def setUp(self): - super(TestFetchmailNotifyErrorToSender, self).setUp() - - self.fetchmail_server = self.env["fetchmail.server"].create( - { - "name": "Test Fetchmail Server", - "server_type": "imap", - "error_notice_template_id": self.env.ref( - "%s.%s" - % ( - "fetchmail_notify_error_to_sender", - "email_template_error_notice", - ) - ).id, - } - ) - - def format_and_process_with_context( - self, - template, - to_email="groups@example.com, other@gmail.com", - subject="Frogs", - extra="", - email_from="Sylvie Lelitre ", - cc_email="", - msg_id="<1198923581.41972151344608186760.JavaMail@agrolait.com>", - model=None, - target_model="mail.test.simple", - target_field="name", - ctx=None, - ): - self.assertFalse(self.env[target_model].search([(target_field, "=", subject)])) - mail = template.format( - to=to_email, - subject=subject, - cc=cc_email, - extra=extra, - email_from=email_from, - msg_id=msg_id, - ) - self.env["mail.thread"].with_context(ctx or {}).message_process( - model, mail, - ) - return self.env[target_model].search([(target_field, "=", subject)]) - - @mute_logger("odoo.addons.mail.models.mail_thread", "odoo.models") - def test_message_process(self): - email_from = formataddr((self.partner_1.name, self.partner_1.email)) - - count_return_mails_before = self.env["mail.mail"].search_count( - [("email_to", "=", email_from)] - ) - - with self.assertRaises(ValueError): - self.format_and_process_with_context( - MAIL_TEMPLATE, - email_from=email_from, - to_email="noone@example.com", - subject="spam", - extra="In-Reply-To: <12321321-openerp-%d-mail.test.simple@%s" - ">" % (self.test_record.id, socket.gethostname(),), - ctx={"default_fetchmail_server_id": self.fetchmail_server.id}, - ) - - count_return_mails_after = self.env["mail.mail"].search_count( - [("email_to", "=", email_from)] - ) - self.assertEqual( - count_return_mails_after, count_return_mails_before + 1, - )