From 64afdd9be5e91965ab911527cad786c6ca98f585 Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Mon, 26 Feb 2024 15:50:10 +0100 Subject: [PATCH] [FIX]hr_holidays_calendar_event_privacy: Fix test in time --- .../tests/test_hr_leave_calendar_event.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/hr_holidays_calendar_event_privacy/tests/test_hr_leave_calendar_event.py b/hr_holidays_calendar_event_privacy/tests/test_hr_leave_calendar_event.py index 7bb5bff9..def65803 100644 --- a/hr_holidays_calendar_event_privacy/tests/test_hr_leave_calendar_event.py +++ b/hr_holidays_calendar_event_privacy/tests/test_hr_leave_calendar_event.py @@ -2,10 +2,13 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) from datetime import timedelta +from freezegun import freeze_time + from odoo import fields from odoo.tests import Form, TransactionCase +@freeze_time("2024-01-01") class TestHrLeaveCalendarEvent(TransactionCase): @classmethod def setUpClass(cls): @@ -24,15 +27,15 @@ def _new_leave_request(cls, date_from, date_to): def test_calendar_event_privacy(self): self.assertEqual(self.leave_type.calendar_event_privacy, "confidential") leave = self._new_leave_request( - fields.Date.today() + timedelta(days=12), - fields.Date.today() + timedelta(days=13), + fields.Date.today() + timedelta(days=2), + fields.Date.today() + timedelta(days=3), ) leave.action_validate() self.assertEqual(leave.meeting_id.privacy, "confidential") self.leave_type.calendar_event_privacy = "public" leave = self._new_leave_request( - fields.Date.today() + timedelta(days=13), - fields.Date.today() + timedelta(days=14), + fields.Date.today() + timedelta(days=3), + fields.Date.today() + timedelta(days=4), ) leave.action_validate() self.assertEqual(leave.meeting_id.privacy, "public")