-
-
Notifications
You must be signed in to change notification settings - Fork 56
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 falining AT Collection creation when using api.content.create. #414
Changes from 2 commits
2fa3b01
ddeeac3
81fef76
31119fe
bac3db8
d491d6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -376,6 +376,64 @@ def test_create_at_with_title_in_request(self): | |
|
||
self.assertEqual(page.title, 'Test document') | ||
|
||
@unittest.skipIf(HAS_PACONTENTYPES, 'Archetypes only') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gbastien thinking minor, I think this test should run with dx too. Collection creation should work with dx. You can remove this condition and change the name of the test. |
||
def test_create_at_collection(self): | ||
"""Test create at Collecition.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo |
||
collection = api.content.create( | ||
container=self.portal, | ||
type='Collection', | ||
title='Mandelbrot set', | ||
description='Image gallery of a zoom sequence', | ||
query=[ | ||
{ | ||
'i': 'Type', | ||
'o': 'plone.app.querystring.operation.string.is', | ||
'v': ['Image'], | ||
}, | ||
], | ||
) | ||
self.assertEqual(collection.Title(), 'Mandelbrot set') | ||
|
||
@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""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @hvelarde what's the relationship between plone/plone.app.contenttypes#465 and I think this test can continue but without reference to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC, I was unable to reproduce it on a clean Plone installation; so maybe it's not related at all; we may remove the reference. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I fixed the typos and run test for AT and DX and Travis is green. I kept the test regarding the event creation, do not know if it is necessary now that we have a test with Collection creation for AT and DX? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact what avoids #364 is the AT test. But it's good to have an event creation test with DX There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK so I would remove the test_create_at_event, unnecessary now because of test_create_collection? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, so let's merge? :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gbastien I think it is necessary now only to remove the reference: plone/plone.app.contenttypes#465 in docstring. |
||
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.""" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo