Skip to content

Commit

Permalink
fix time-dependence of event recurrent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Dec 11, 2024
1 parent 447a87c commit 0e11a5b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plone/restapi/tests/test_serializer_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from zope.interface import alsoProvides

import Missing
import pytz
import unittest


Expand Down Expand Up @@ -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
)

Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 0e11a5b

Please sign in to comment.