Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix time-dependence of event recurrent tests #1850

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading