A simple test the make sure the traversal adapters for image scales are working correctly. First we have to create an image to start with: >>> from plone.app.testing import TEST_USER_ID, setRoles >>> setRoles(layer['portal'], TEST_USER_ID, ['Manager']) >>> from plone.app.imaging.tests.utils import getData >>> data = getData('image.gif') >>> portal = layer['portal'] >>> portal.invokeFactory('Image', id='foo', title='Foo', image=data) 'foo' >>> portal.foo.getField('image').removeScales(portal.foo) >>> from transaction import commit >>> commit() Then we can use a testbrowser to access the image itself and a scaled down version: >>> from plone.testing.z2 import Browser >>> from plone.app.testing import TEST_USER_NAME, TEST_USER_PASSWORD >>> browser = Browser(layer['app']) >>> browser.addHeader('Authorization', 'Basic %s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD)) >>> browser.open('http://nohost/plone/foo') >>> browser.contents 'GIF89a...' >>> len(browser.contents) == len(data) True Let's analyse the image a little further: >>> from PIL.Image import open >>> from StringIO import StringIO >>> image = open(StringIO(browser.contents)) >>> image.format 'GIF' >>> image.size (200, 200) Now check the scaled version: >>> browser.open('http://nohost/plone/foo/image_thumb') >>> browser.contents 'GIF87a...' >>> image = open(StringIO(browser.contents)) >>> image.format 'GIF' >>> image.size (128, 128) We also want to be able to traverse to the image scale in path expressions, which don't use publish traversal: >>> from Products.CMFCore.Expression import Expression, getExprContext >>> def eval_expression(expr): ... econtext = getExprContext(layer['portal']) ... return Expression(expr)(econtext) >>> eval_expression('portal/foo/image_thumb') And let's make sure that we can check for the scale with an 'exists' expression: >>> bool(eval_expression('exists:portal/foo/image_thumb')) True