예제 #1
0
 def test_image_traverser(self):
     obj = self.portal['my-image']
     self.tile.populate_with_object(obj)
     scales = self.layer['portal'].restrictedTraverse('@@%s/%s/@@images' %
                                                      ('collective.cover.image',
                                                       'test-image-tile',))
     img = scales.scale('image')
     self.assertTrue(images_are_equal(str(self.tile.data['image'].data),
                                      str(img.index_html().read())))
예제 #2
0
 def test_image_traverser(self):
     obj = self.portal['my-image']
     self.tile.populate_with_object(obj)
     scales = self.layer['portal'].restrictedTraverse('@@%s/%s/@@images' % (
         'collective.cover.image',
         'test-image-tile',
     ))
     img = scales.scale('image')
     self.assertTrue(
         images_are_equal(str(self.tile.data['image'].data),
                          str(img.index_html().read())))
 def test_image_traverser(self):
     obj = self.portal['my-image']
     data = self.tile.data
     scales = queryMultiAdapter((obj, self.request), name='images')
     self.tile.data['image'] = NamedImageFile(str(scales.scale('image').data))
     data_mgr = ITileDataManager(self.tile)
     data_mgr.set(data)
     scales = self.layer['portal'].restrictedTraverse(
         '@@{0}/{1}/@@images'.format('collective.cover.basic', 'test-basic-tile'))
     img = scales.scale('image')
     self.assertTrue(images_are_equal(str(self.tile.data['image'].data),
                                      str(img.index_html().read())))
예제 #4
0
 def test_image_traverser(self):
     obj = self.portal['my-image']
     data = self.tile.data
     scales = api.content.get_view(u'images', obj, self.request)
     self.tile.data['image'] = NamedImageFile(str(scales.scale('image').data))
     data_mgr = ITileDataManager(self.tile)
     data_mgr.set(data)
     scales = self.cover.restrictedTraverse(
         '@@{0}/{1}/@@images'.format('collective.cover.basic', 'test'))
     img = scales.scale('image')
     self.assertTrue(images_are_equal(str(self.tile.data['image'].data),
                                      str(img.index_html().read())))
예제 #5
0
 def test_image_traverser(self):
     obj = self.portal["my-image"]
     data = self.tile.data
     scales = queryMultiAdapter((obj, self.request), name="images")
     self.tile.data["image"] = NamedImageFile(str(scales.scale("image").data))
     data_mgr = ITileDataManager(self.tile)
     data_mgr.set(data)
     scales = self.layer["portal"].restrictedTraverse(
         "@@%s/%s/@@images" % ("collective.cover.basic", "test-basic-tile")
     )
     img = scales.scale("image")
     self.assertTrue(images_are_equal(str(self.tile.data["image"].data), str(img.index_html().read())))
 def test_image_traverser(self):
     obj = self.portal['my-image']
     data = self.tile.data
     scales = queryMultiAdapter((obj, self.request), name="images")
     self.tile.data['image'] = NamedImageFile(
         str(scales.scale('image').data))
     data_mgr = ITileDataManager(self.tile)
     data_mgr.set(data)
     scales = self.layer['portal'].restrictedTraverse(
         '@@{0}/{1}/@@images'.format('collective.cover.basic',
                                     'test-basic-tile'))
     img = scales.scale('image')
     self.assertTrue(
         images_are_equal(str(self.tile.data['image'].data),
                          str(img.index_html().read())))
예제 #7
0
    def test_change_images(self):
        obj = self.portal['my-image']
        obj1 = self.portal['my-image1']
        obj2 = self.portal['my-image2']

        tile = self.layer['portal'].restrictedTraverse('@@%s/%s' % (
            'collective.cover.image',
            'test-image-tile',
        ))
        tile.populate_with_object(obj1)
        rendered = tile()
        self.assertTrue('test-image-tile/@@images' in rendered)
        self.assertTrue(
            images_are_equal(str(tile.data['image'].data),
                             str(obj1.getImage())))
        scales = self.layer['portal'].restrictedTraverse('@@%s/%s/@@images' % (
            'collective.cover.image',
            'test-image-tile',
        ))
        img = scales.scale('image')
        self.assertTrue(
            images_are_equal(str(tile.data['image'].data),
                             str(img.index_html().read())))
        self.assertTrue(
            images_are_equal(str(img.index_html().read()),
                             str(obj1.getImage())))

        tile = self.layer['portal'].restrictedTraverse('@@%s/%s' % (
            'collective.cover.image',
            'test-image-tile',
        ))
        tile.populate_with_object(obj)
        rendered = tile()
        self.assertTrue('test-image-tile/@@images' in rendered)
        self.assertFalse(
            images_are_equal(str(tile.data['image'].data),
                             str(obj1.getImage())))
        self.assertTrue(
            images_are_equal(str(tile.data['image'].data),
                             str(obj.getImage())))
        scales = self.layer['portal'].restrictedTraverse('@@%s/%s/@@images' % (
            'collective.cover.image',
            'test-image-tile',
        ))
        img = scales.scale('image')
        self.assertTrue(
            images_are_equal(str(tile.data['image'].data),
                             str(img.index_html().read())))
        self.assertTrue(
            images_are_equal(str(img.index_html().read()),
                             str(obj.getImage())))

        tile = self.layer['portal'].restrictedTraverse('@@%s/%s' % (
            'collective.cover.image',
            'test-image-tile',
        ))
        tile.populate_with_object(obj2)
        rendered = tile()
        self.assertTrue('test-image-tile/@@images' in rendered)
        self.assertFalse(
            images_are_equal(str(tile.data['image'].data),
                             str(obj1.getImage())))
        self.assertFalse(
            images_are_equal(str(tile.data['image'].data),
                             str(obj.getImage())))
        self.assertTrue(
            images_are_equal(str(tile.data['image'].data),
                             str(obj2.getImage())))
        scales = self.layer['portal'].restrictedTraverse('@@%s/%s/@@images' % (
            'collective.cover.image',
            'test-image-tile',
        ))
        img = scales.scale('image')
        self.assertTrue(
            images_are_equal(str(tile.data['image'].data),
                             str(img.index_html().read())))
        self.assertTrue(
            images_are_equal(str(img.index_html().read()),
                             str(obj2.getImage())))
예제 #8
0
    def test_change_images(self):
        obj = self.portal['my-image']
        obj1 = self.portal['my-image1']
        obj2 = self.portal['my-image2']

        tile = self.layer['portal'].restrictedTraverse('@@%s/%s' %
                                                       ('collective.cover.image',
                                                        'test-image-tile',))
        tile.populate_with_object(obj1)
        rendered = tile()
        self.assertTrue('test-image-tile/@@images' in rendered)
        self.assertTrue(images_are_equal(str(tile.data['image'].data),
                                         str(obj1.getImage())))
        scales = self.layer['portal'].restrictedTraverse('@@%s/%s/@@images' %
                                                         ('collective.cover.image',
                                                          'test-image-tile',))
        img = scales.scale('image')
        self.assertTrue(images_are_equal(str(tile.data['image'].data),
                                         str(img.index_html().read())))
        self.assertTrue(images_are_equal(str(img.index_html().read()),
                                         str(obj1.getImage())))

        tile = self.layer['portal'].restrictedTraverse('@@%s/%s' %
                                                       ('collective.cover.image',
                                                        'test-image-tile',))
        tile.populate_with_object(obj)
        rendered = tile()
        self.assertTrue('test-image-tile/@@images' in rendered)
        self.assertFalse(images_are_equal(str(tile.data['image'].data),
                                          str(obj1.getImage())))
        self.assertTrue(images_are_equal(str(tile.data['image'].data),
                                         str(obj.getImage())))
        scales = self.layer['portal'].restrictedTraverse('@@%s/%s/@@images' %
                                                         ('collective.cover.image',
                                                          'test-image-tile',))
        img = scales.scale('image')
        self.assertTrue(images_are_equal(str(tile.data['image'].data),
                                         str(img.index_html().read())))
        self.assertTrue(images_are_equal(str(img.index_html().read()),
                                         str(obj.getImage())))

        tile = self.layer['portal'].restrictedTraverse('@@%s/%s' %
                                                       ('collective.cover.image',
                                                        'test-image-tile',))
        tile.populate_with_object(obj2)
        rendered = tile()
        self.assertTrue('test-image-tile/@@images' in rendered)
        self.assertFalse(images_are_equal(str(tile.data['image'].data),
                                          str(obj1.getImage())))
        self.assertFalse(images_are_equal(str(tile.data['image'].data),
                                          str(obj.getImage())))
        self.assertTrue(images_are_equal(str(tile.data['image'].data),
                                         str(obj2.getImage())))
        scales = self.layer['portal'].restrictedTraverse('@@%s/%s/@@images' %
                                                         ('collective.cover.image',
                                                          'test-image-tile',))
        img = scales.scale('image')
        self.assertTrue(images_are_equal(str(tile.data['image'].data),
                                         str(img.index_html().read())))
        self.assertTrue(images_are_equal(str(img.index_html().read()),
                                         str(obj2.getImage())))