Commit edf87682 authored by Ivan Tyagov's avatar Ivan Tyagov

Test that embedded in Web Page's content relative images get auto converted.

parent 8ce12b78
......@@ -28,7 +28,7 @@
##############################################################################
import unittest
from testDms import TestDocument
from testDms import TestDocument, makeFileUpload
class TestDocumentWithPreConversion(TestDocument):
"""
......@@ -40,6 +40,31 @@ class TestDocumentWithPreConversion(TestDocument):
def getTitle(self):
return "DMS with Preconversion"
def test_preConvertedEmbeddedImageInWebPageContent(self):
# create an image
upload_file = makeFileUpload('cmyk_sample.jpg')
image = self.portal.image_module.newContent(portal_type='Image',
reference='Embedded-XXX',
version='001',
language='en')
image.edit(file=upload_file)
image.publish()
self.tic()
web_page = self.portal.web_page_module.newContent(portal_type="Web Page")
web_page.setTextContent('''<b> test </b>
<img src="Embedded-XXX?format=png&display=large&quality=75"/>
<img src="Embedded-XXX?format=jpeg&display=large&quality=75"/>''')
self.tic()
# check that referenced in Web Page's content image(s) is well converted
self.assertTrue(image.hasConversion(**{'format':'jpeg', 'display':'large', 'quality':75}))
self.assertTrue(image.hasConversion(**{'format':'png', 'display':'large', 'quality':75}))
self.assertSameSet(['Embedded-XXX?format=png&display=large&quality=75', \
'Embedded-XXX?format=jpeg&display=large&quality=75'],
web_page.Base_extractImageUrlList())
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestDocumentWithPreConversion))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment