Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
162 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Improved serialization/deserialization of the Plone Site root to make | ||
possible an opt-in to support Tiles attributes on it. The @workflow endpoint | ||
now answers an empty object instead of a 404 for the Plone Site Root object, | ||
hiding the implementation details (the Plone Site Root has no workflow for | ||
historical reasons) and equalizing it to the other content types, making the | ||
API more consistent. | ||
[sneridagh] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
from plone.restapi.interfaces import IDeserializeFromJson | ||
from plone.restapi.testing import PLONE_RESTAPI_DX_INTEGRATION_TESTING | ||
from zope.component import getMultiAdapter | ||
|
||
import json | ||
import unittest | ||
|
||
|
||
class TestDXContentDeserializer(unittest.TestCase): | ||
|
||
layer = PLONE_RESTAPI_DX_INTEGRATION_TESTING | ||
|
||
def setUp(self): | ||
self.portal = self.layer['portal'] | ||
self.request = self.layer['request'] | ||
|
||
def deserialize(self, body='{}', validate_all=False, context=None): | ||
context = context or self.portal | ||
self.request['BODY'] = body | ||
deserializer = getMultiAdapter((context, self.request), | ||
IDeserializeFromJson) | ||
return deserializer(validate_all=validate_all) | ||
|
||
def test_opt_in_tiles_deserializer(self): | ||
tiles = { | ||
"0358abe2-b4f1-463d-a279-a63ea80daf19": { | ||
"@type": "description" | ||
}, | ||
"07c273fc-8bfc-4e7d-a327-d513e5a945bb": { | ||
"@type": "title" | ||
} | ||
} | ||
tiles_layout = { | ||
"items": [ | ||
"07c273fc-8bfc-4e7d-a327-d513e5a945bb", | ||
"0358abe2-b4f1-463d-a279-a63ea80daf19" | ||
] | ||
} | ||
|
||
self.deserialize( | ||
body='{{"tiles": {}, "tiles_layout": {}}}'.format( | ||
json.dumps(tiles), json.dumps(tiles_layout))) | ||
|
||
self.assertEqual(tiles, json.loads(self.portal.tiles)) | ||
self.assertEqual(tiles_layout, json.loads(self.portal.tiles_layout)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters