Skip to content

Commit

Permalink
Add event type to docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
tisto committed Apr 24, 2015
1 parent da4a54e commit 5755de0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/source/_json/event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"@context": "http://www.w3.org/ns/hydra/context.jsonld",
"@id": "http://localhost:55001/plone/event",
"@type": "Event",
"contributors": [],
"creators": [
"test_user_1_"
],
"description": "This is an event",
"effective": "1969-12-31T00:00:00+02:00",
"exclude_from_nav": "False",
"expires": "2499-12-31T00:00:00+02:00",
"icon": "++resource++plone.dexterity.item.gif",
"isPrincipiaFolderish": "0",
"language": "",
"meta_type": "Dexterity Item",
"parent": {
"@id": "http://localhost:55001/plone",
"description": "",
"title": "Plone site"
},
"relatedItems": [],
"rights": "",
"title": "Event"
}
5 changes: 5 additions & 0 deletions docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ News Item:
.. literalinclude:: _json/newsitem.json
:language: json-ld

Event:

.. literalinclude:: _json/event.json
:language: json-ld

Image:

.. literalinclude:: _json/image.json
Expand Down
16 changes: 16 additions & 0 deletions src/plone/restapi/tests/test_documentation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from plone.restapi.testing import PLONE_RESTAPI_FUNCTIONAL_TESTING
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
Expand Down Expand Up @@ -90,6 +91,21 @@ def test_documentation_news_item(self):
)
save_response_for_documentation('newsitem.json', response)

def test_documentation_event(self):
self.portal.invokeFactory('Event', id='event')
self.portal.event.title = 'Event'
self.portal.event.description = u'This is an event'
self.portal.event.start = datetime(2013, 1, 1, 10, 0)
self.portal.event.end = datetime(2013, 1, 1, 12, 0)
import transaction
transaction.commit()
response = requests.get(
self.portal.event.absolute_url(),
headers={'content-type': 'application/json'},
auth=(SITE_OWNER_NAME, SITE_OWNER_PASSWORD)
)
save_response_for_documentation('event.json', response)

def test_documentation_link(self):
self.portal.invokeFactory('Link', id='link')
self.portal.link.title = 'My Link'
Expand Down

0 comments on commit 5755de0

Please sign in to comment.