Skip to content

Commit

Permalink
Use layer PLONE_RESTAPI_BLOCKS_FUNCTIONAL_TESTING
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleybl committed Mar 26, 2024
1 parent a305c3c commit 13f1d47
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/plone/restapi/tests/test_content_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from plone.app.textfield.value import RichTextValue
from plone.namedfile.file import NamedBlobImage
from plone.restapi import HAS_PLONE_6
from plone.restapi.testing import PLONE_RESTAPI_BLOCKS_FUNCTIONAL_TESTING
from plone.restapi.testing import PLONE_RESTAPI_DX_FUNCTIONAL_TESTING
from Products.CMFCore.utils import getToolByName
from z3c.relationfield import RelationValue
Expand Down Expand Up @@ -178,20 +179,15 @@ def test_get_content_related_items_without_workflow(self):
response.json()["relatedItems"],
)

@unittest.skipUnless(HAS_PLONE_6, "This not working in Plone 5.2")
def test_image_scales_get(self):
from plone.app.testing import applyProfile
from plone.restapi.interfaces import ISerializeToJson
from zope.component import getMultiAdapter

applyProfile(self.portal, "plone.restapi:blocks")
class TestBlocksContentGet(unittest.TestCase):
layer = PLONE_RESTAPI_BLOCKS_FUNCTIONAL_TESTING

def serialize(self, obj=None):
if obj is None:
obj = self.portal.doc1
serializer = getMultiAdapter((obj, self.request), ISerializeToJson)
return serializer()
def setUp(self):
self.portal = self.layer["portal"]

@unittest.skipUnless(HAS_PLONE_6, "This not working in Plone 5.2")
def test_image_scales_get(self):
self.portal.invokeFactory("Image", id="imagewf")
self.portal.imagewf.title = "Image without workflow"
self.portal.imagewf.description = "This is an image"
Expand All @@ -201,7 +197,6 @@ def serialize(self, obj=None):
self.portal.imagewf.image = NamedBlobImage(
data=image_data, contentType="image/png", filename="image.png"
)
transaction.commit()

image_uid = self.portal.imagewf.UID()
blocks = {"123": {"@type": "image", "url": f"../resolveuid/{image_uid}"}}
Expand Down

0 comments on commit 13f1d47

Please sign in to comment.