Skip to content

Commit

Permalink
Add test cases for some weird issues with Event content type
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Aug 10, 2018
1 parent c242efc commit f67faca
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/plone/api/tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,46 @@ def test_create_at_with_title_in_request(self):

self.assertEqual(page.title, 'Test document')

@unittest.skipIf(HAS_PACONTENTYPES, 'Archetypes only')
def test_create_at_event(self):
"""https://github.com/plone/plone.api/issues/364"""
from DateTime import DateTime
today = DateTime()
tomorrow = today + 1
event = api.content.create(
container=self.portal,
type='Event',
title=u'My event',
startDate=today,
endDate=tomorrow,
)
self.assertEqual(event.startDate, today)
self.assertEqual(event.endDate, tomorrow)
results = api.content.find(Title=u'My event')
self.assertEqual(len(results), 1)
self.assertEqual(results[0].start, today)
self.assertEqual(results[0].end, tomorrow)

@unittest.skipUnless(HAS_PACONTENTYPES, 'Dexterity only')
def test_create_dx_event(self):
"""https://github.com/plone/plone.app.contenttypes/issues/465"""
import datetime
today = datetime.datetime.now()
tomorrow = today + datetime.timedelta(days=1)
event = api.content.create(
container=self.portal,
type='Event',
title=u'My event',
start=today,
end=tomorrow,
)
self.assertEqual(event.start, today)
self.assertEqual(event.end, tomorrow)
results = api.content.find(Title=u'My event')
self.assertEqual(len(results), 1)
self.assertEqual(results[0].start, today)
self.assertEqual(results[0].end, tomorrow)

def test_get_constraints(self):
"""Test the constraints when content is fetched with get."""

Expand Down

0 comments on commit f67faca

Please sign in to comment.