Skip to content

Commit

Permalink
[MIG] privacy_consent: Fix Tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiToledo committed Feb 11, 2025
1 parent 3db75de commit 1996a0f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions privacy_consent/tests/test_consent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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):
Expand Down

0 comments on commit 1996a0f

Please # to comment.