def createImage(self, path, width=800, height=600, title=None): obj = self._createObject('Image', path, title=title) named_image = NamedImage() named_image.data = random_image(width, height) named_image.filename = u'test.jpg' named_image.contentType = u'image/jpg' obj.image = named_image obj.reindexObject()
def createNewsitem(self, path, title=None): obj = self._createObject('News Item', path, title=title) named_image = NamedImage() named_image.data = random_image(400, 200) named_image.filename = u'test.jpg' named_image.contentType = u'image/jpg' obj.image = named_image obj.reindexObject()
def createImage(self, path, width=800, height=600, title=None): obj = self._createObject('Image', path, title=title) named_image = NamedImage() named_image.data = random_image(width, height) named_image.filename = u'test.jpg' named_image.contentType = u'image/jpg' obj.image = named_image obj.reindexObject()
def createNewsitem(self, path, title=None): obj = self._createObject('News Item', path, title=title) named_image = NamedImage() named_image.data = random_image(400, 200) named_image.filename = u'test.jpg' named_image.contentType = u'image/jpg' obj.image = named_image obj.reindexObject()
def test_xml_image(self): from plone.namedfile import NamedImage img_data = open(os.path.join(os.path.dirname(__file__), 'sample.jpg'), 'rb').read() named_image = NamedImage() named_image.data = img_data named_image.filename = u'test.jpg' named_image.contentType = 'image/jpg' self.doc.xml_set('xml_image', named_image) named_image2 = self.doc.xml_get('xml_image') self.assertEqual(named_image2.data, img_data) self.assertEqual(named_image2.filename, u'test.jpg') self.assertEqual(named_image2.contentType, 'image/jpg')
def test_xml_image(self): from plone.namedfile import NamedImage img_data = open(os.path.join(os.path.dirname(__file__), 'sample.jpg'), 'rb').read() named_image = NamedImage() named_image.data = img_data named_image.filename = u'test.jpg' named_image.contentType = 'image/jpg' self.doc.xml_set('xml_image', named_image) named_image2 = self.doc.xml_get('xml_image') self.assertEqual(named_image2.data, img_data) self.assertEqual(named_image2.filename, u'test.jpg') self.assertEqual(named_image2.contentType, 'image/jpg')