From 1996a0f67833f0516cb41b0ef5d7504099deda0c Mon Sep 17 00:00:00 2001 From: JordiToledo Date: Tue, 11 Feb 2025 09:00:11 +0100 Subject: [PATCH] [MIG] privacy_consent: Fix Tests. --- privacy_consent/tests/test_consent.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/privacy_consent/tests/test_consent.py b/privacy_consent/tests/test_consent.py index f9d18407..b5b98b5c 100644 --- a/privacy_consent/tests/test_consent.py +++ b/privacy_consent/tests/test_consent.py @@ -2,11 +2,10 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from contextlib import contextmanager +from unittest.mock import patch import requests -from unittest.mock import patch - import odoo.tests from odoo import http from odoo.exceptions import AccessError, ValidationError @@ -78,7 +77,6 @@ def setUp(self): @contextmanager def _patch_build(self): self._built_messages = [] - IMS = self.env["ir.mail_server"] def _build_email(_self, email_from, email_to, subject, body, *args, **kwargs): self._built_messages.append(body) @@ -91,9 +89,13 @@ def _build_email(_self, email_from, email_to, subject, body, *args, **kwargs): *args, **kwargs, ) - with patch.object(IMS, "build_email", side_effect=_build_email): + + with patch.object( + self.env["ir.mail_server"], "build_email", side_effect=_build_email + ): yield + @odoo.tests.tagged("post_install", "-at_install") class ActivityFlow(ActivityCase): def check_activity_auto_properly_sent(self):