Exemple #1
0
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.portal.invokeFactory('Folder', 'test-folder')
        setRoles(self.portal, TEST_USER_ID, ['Member'])
        self.folder = self.portal['test-folder']

        self.folder.invokeFactory('File',
                                  id='v1',
                                  title='Video File',
                                  file=dummy.File(filename='test.mp4',
                                                  data=MP4))
        self.v1 = self.folder['v1']
        event = set_media_layout(self.v1, self.portal.REQUEST)
        notify(event)

        self.folder.invokeFactory('File',
                                  id='a1',
                                  title='Audio File',
                                  file=dummy.File(filename='test.mp3',
                                                  data=MP3))
        self.a1 = self.folder['a1']
        event = set_media_layout(self.a1, self.portal.REQUEST)
        notify(event)
    def test_mp4_create(self):
        self.folder.invokeFactory('File', id='mp4', title='MP4 File', file=dummy.File(filename='test.mp4', data=MP4))
        mp4= self.folder['mp4']
        self.assertEqual(str(mp4), MP4)

        event = set_media_layout(mp4, self.portal.REQUEST)
        notify(event)
        self.assertEqual(mp4.getLayout(),'video_file')
    def test_mp3_create(self):
        self.folder.invokeFactory('File', id='mp3', title='MP3 File', file=dummy.File(filename='test.mp3', data=MP3))
        mp3= self.folder['mp3']
        self.assertEqual(str(mp3), MP3)

        event = set_media_layout(mp3, self.portal.REQUEST)
        notify(event)
        self.assertEqual(mp3.getLayout(),'audio_file')
    def test_flv_create(self):
        self.folder.invokeFactory('File', id='flv', title='FLV File', file=dummy.File(filename='test.flv', data=FLV))
        flv = self.folder['flv']
        self.assertEqual(str(flv), FLV)

        event = set_media_layout(flv, self.portal.REQUEST)
        notify(event)
        self.assertEqual(flv.getLayout(),'video_file')
    def test_avi_create(self):
        self.folder.invokeFactory('File', id='avi', title='AVI File', file=dummy.File(filename='test.avi', data=AVI))
        avi = self.folder['avi']
        self.assertEqual(str(avi), AVI)

        event = set_media_layout(avi, self.portal.REQUEST)
        notify(event)
        self.assertEqual(avi.getLayout(),'video_file')
    def test_swf_create(self):
        self.folder.invokeFactory('File', id='swf', title='SWF File', file=dummy.File(filename='test.swf', data=SWF))
        swf= self.folder['swf']
        self.assertEqual(str(swf), SWF)

        event = set_media_layout(swf, self.portal.REQUEST)
        notify(event)
        self.assertEqual(swf.getLayout(),'flash_file')
    def test_ogm_create(self):
        self.folder.invokeFactory('File', id='ogm', title='OGM File', file=dummy.File(filename='test.ogm', data=OGM))
        ogm= self.folder['ogm']
        self.assertEqual(str(ogm), OGM)

        event = set_media_layout(ogm, self.portal.REQUEST)
        notify(event)
        self.assertEqual(ogm.getLayout(),'video_file')
    def setUp(self):
        self.portal = self.layer['portal']
        self.request = self.layer['request']

        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.portal.invokeFactory('Folder', 'test-folder')
        setRoles(self.portal, TEST_USER_ID, ['Member'])
        self.folder = self.portal['test-folder']

        self.folder.invokeFactory('File', id='v1', title='Video File', file=dummy.File(filename='test.mp4', data=MP4))
        self.v1 = self.folder['v1']
        event = set_media_layout(self.v1, self.portal.REQUEST)
        notify(event)

        self.folder.invokeFactory('File', id='a1', title='Audio File', file=dummy.File(filename='test.mp3', data=MP3))
        self.a1 = self.folder['a1']
        event = set_media_layout(self.a1, self.portal.REQUEST)
        notify(event)