From 0e11a5b8e361f4d1eb23eb0fbe649cb608f2f2b5 Mon Sep 17 00:00:00 2001 From: David Glick Date: Wed, 11 Dec 2024 15:43:48 -0800 Subject: [PATCH 1/2] fix time-dependence of event recurrent tests --- src/plone/restapi/tests/test_serializer_summary.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plone/restapi/tests/test_serializer_summary.py b/src/plone/restapi/tests/test_serializer_summary.py index 9a7b7db45..e186c2f31 100644 --- a/src/plone/restapi/tests/test_serializer_summary.py +++ b/src/plone/restapi/tests/test_serializer_summary.py @@ -17,6 +17,7 @@ from zope.interface import alsoProvides import Missing +import pytz import unittest @@ -234,14 +235,15 @@ def setUp(self): ) self.portal.portal_types.DXTestDocument.behaviors = behaviors + self.start = datetime(1995, 7, 31, 13, 45, tzinfo=pytz.timezone("UTC")) self.event = createContentInContainer( self.portal, "DXTestDocument", id="doc1", title="Lorem Ipsum event", description="Description event", - start=datetime.now(), - end=datetime.now() + timedelta(hours=1), + start=self.start, + end=self.start + timedelta(hours=1), recurrence="RRULE:FREQ=DAILY;COUNT=3", # see https://github.com/plone/plone.app.event/blob/master/plone/app/event/tests/base_setup.py ) @@ -256,7 +258,7 @@ def tearDown(self): "this test needs a plone.app.event version that does not include a IContentListingObject adapter", ) def test_dx_event_with_recurrence_old_version(self): - tomorrow = datetime.now() + timedelta(days=1) + tomorrow = self.start + timedelta(days=1) tomorrow_str = tomorrow.strftime("%Y-%m-%d") ot = OccurrenceTraverser(self.event, self.request) ocurrence = ot.publishTraverse(self.request, tomorrow_str) @@ -269,7 +271,7 @@ def test_dx_event_with_recurrence_old_version(self): "this test needs a plone.app.event version that includes a IContentListingObject adapter", ) def test_dx_event_with_recurrence_new_version(self): - tomorrow = datetime.now() + timedelta(days=1) + tomorrow = self.start + timedelta(days=1) tomorrow_str = tomorrow.strftime("%Y-%m-%d") ot = OccurrenceTraverser(self.event, self.request) ocurrence = ot.publishTraverse(self.request, tomorrow_str) From 9685eee925acde17a8b805f611ceb665dec7faeb Mon Sep 17 00:00:00 2001 From: David Glick Date: Wed, 11 Dec 2024 15:45:03 -0800 Subject: [PATCH 2/2] changelog --- news/1850.internal | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/1850.internal diff --git a/news/1850.internal b/news/1850.internal new file mode 100644 index 000000000..d4a67450a --- /dev/null +++ b/news/1850.internal @@ -0,0 +1 @@ +Fix time-dependence of tests. @davisagli