From 080688868e6acf31d3bd624798559852272bcc1a Mon Sep 17 00:00:00 2001 From: Arnaud Joset Date: Mon, 6 Nov 2023 12:27:57 +0100 Subject: [PATCH] [FIX] calendar: test was trying to send mails for past events Before this commit, the test was trying to send mail for a past event. It would fail with the following error: ``` FAIL: TestCalendar.test_event_creation_mail Traceback (most recent call last): File "/data/build/odoo/addons/calendar/tests/test_calendar.py", line 329, in test_event_creation_mail _test_one_mail_per_attendee(self, partners) File "/data/build/odoo/addons/calendar/tests/test_calendar.py", line 311, in _test_one_mail_per_attendee self.assertEqual(len(mail), 1) AssertionError: 0 != 1 ``` https://runbot.odoo.com/web/#id=29871&view_type=form&model=runbot.build.error&menu_id=405&cids=1 closes odoo/odoo#141411 X-original-commit: 2b0bedf5a57ca2733501359fb8cc8e5bc743a4fa Signed-off-by: Arnaud Joset (arj) --- addons/calendar/tests/test_calendar.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/calendar/tests/test_calendar.py b/addons/calendar/tests/test_calendar.py index 8e70d5ad2eb..909435b93ae 100644 --- a/addons/calendar/tests/test_calendar.py +++ b/addons/calendar/tests/test_calendar.py @@ -7,6 +7,8 @@ from datetime import date, datetime, timedelta from odoo import fields, Command from odoo.tests import Form, HttpCase, tagged from odoo.addons.base.tests.common import SavepointCaseWithUserDemo + +import freezegun import pytz import re @@ -296,8 +298,10 @@ class TestCalendar(SavepointCaseWithUserDemo): self.assertEqual(str(activity_id.date_deadline), '2018-10-16') + @freezegun.freeze_time('2023-10-06 10:00:00') def test_event_creation_mail(self): """ + Freezegun used because we don't send mail for past events Check that mail are sent to the attendees on event creation Check that mail are sent to the added attendees on event edit Check that mail are NOT sent to the attendees when the event date is past