Skip to content

Commit

Permalink
Merge branch 'main' into cekk_path2uid_handle_aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Dec 12, 2024
2 parents 7c2f424 + d012d3f commit 41a5df6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions news/1850.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix time-dependence of tests. @davisagli
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 41a5df6

Please sign in to comment.