-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a JsonCompatible adapter for RichTextValue objects
- Loading branch information
Showing
5 changed files
with
90 additions
and
18 deletions.
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,2 @@ | ||
Provide a JsonCompatible adapter for RichTextValue objects | ||
[erral] |
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,18 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import unittest | ||
from plone.app.textfield import RichTextValue | ||
from plone.restapi.interfaces import IJsonCompatible | ||
from plone.restapi.testing import PLONE_RESTAPI_DX_INTEGRATION_TESTING | ||
|
||
|
||
class TestConverters(unittest.TestCase): | ||
|
||
layer = PLONE_RESTAPI_DX_INTEGRATION_TESTING | ||
|
||
def test_richtextvalue_converter(self): | ||
"""test that a RichTextValue is converted to a proper HTML""" | ||
html = "<p>This is a demo HTML</p>" | ||
value = RichTextValue(html, "text/html", "text/html") | ||
json_compatible_value = IJsonCompatible(value) | ||
self.assertEqual(json_compatible_value, html) |
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