Exemple #1
0
    def test_get_files(self):
        files = self.view.get_files()
        self.assertEqual(len(files), 0)

        file = api.content.create(self.n1, 'File', title='foo', description='bar')
        set_file_field(file, FRACTAL, 'image/jpeg')
        files = self.view.get_files()
        self.assertEqual(len(files), 1)
        self.assertEqual(files[0].getObject().Title(), 'foo')
        self.assertEqual(files[0].getObject().Description(), 'bar')
Exemple #2
0
    def test_get_files(self):
        files = self.view.get_files()
        self.assertEqual(len(files), 0)

        file = api.content.create(self.n1,
                                  'File',
                                  title='foo',
                                  description='bar')
        set_file_field(file, FRACTAL, 'image/jpeg')
        files = self.view.get_files()
        self.assertEqual(len(files), 1)
        self.assertEqual(files[0].getObject().Title(), 'foo')
        self.assertEqual(files[0].getObject().Description(), 'bar')
Exemple #3
0
    def test_get_media(self):
        media = self.view.get_media()
        self.assertEqual(len(media), 0)

        image = api.content.create(self.n1, 'Image', title='foo')
        set_image_field(image, FRACTAL, 'image/jpeg')
        file = api.content.create(self.n1, 'File', title='bar')
        set_file_field(file, FRACTAL, 'image/jpeg')
        self.n1.invokeFactory('Link', 'baz', remoteUrl='http://baz/')
        media = self.view.get_media()
        self.assertEqual(len(media), 3)
        self.assertEqual(media[0].getObject().Title(), 'foo')
        self.assertEqual(media[1].getObject().id, 'bar')
        self.assertEqual(media[2].getObject().id, 'baz')
Exemple #4
0
    def test_get_media(self):
        media = self.view.get_media()
        self.assertEqual(len(media), 0)

        image = api.content.create(self.n1, 'Image', title='foo')
        set_image_field(image, FRACTAL, 'image/jpeg')
        file = api.content.create(self.n1, 'File', title='bar')
        set_file_field(file, FRACTAL, 'image/jpeg')
        self.n1.invokeFactory('Link', 'baz', remoteUrl='http://baz/')
        media = self.view.get_media()
        self.assertEqual(len(media), 3)
        self.assertEqual(media[0].getObject().Title(), 'foo')
        self.assertEqual(media[1].getObject().id, 'bar')
        self.assertEqual(media[2].getObject().id, 'baz')