コード例 #1
0
ファイル: testContentType.py プロジェクト: bogtan/Naaya
 def test_main(self):
     """ Add, Find, Edit and Delete Naaya Media Files """
     #add NyMediaFile
     addNyMediaFile(self._portal().info, id='media1', title='media1', lang='en', _skip_videofile_check=True)
     addNyMediaFile(self._portal().info, id='media1_fr', title='media1_fr', lang='fr', _skip_videofile_check=True)
     
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Media File'])
     
     ffmpeg = can_convert()
     
     #get added NyMediaFile
     for x in meta:
         if x.getLocalProperty('title', 'en') == 'media1':
             meta = x
         if x.getLocalProperty('title', 'fr') == 'media1_fr':
             meta_fr = x
     
     self.assertEqual(meta.getLocalProperty('title', 'en'), 'media1')
     self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'media1_fr')
     
     #change NyMediaFile title
     meta.saveProperties(title='media1_edited', lang='en')
     meta_fr.saveProperties(title='media1_fr_edited', lang='fr')
     
     self.assertEqual(meta.getLocalProperty('title', 'en'), 'media1_edited')
     self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'media1_fr_edited')
     
     #delete NyMediafile
     self._portal().info.manage_delObjects([meta.id])
     self._portal().info.manage_delObjects([meta_fr.id])
     
     meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Media File'])
     self.assertEqual(meta, [])
コード例 #2
0
    def test_main(self):
        """ Add, Find, Edit and Delete Naaya Media Files """
        # add NyMediaFile
        addNyMediaFile(self._portal().info, id="media1", title="media1", lang="en", _skip_videofile_check=True)
        addNyMediaFile(self._portal().info, id="media1_fr", title="media1_fr", lang="fr", _skip_videofile_check=True)

        meta = self._portal().getCatalogedObjectsCheckView(meta_type=["Naaya Media File"])

        ffmpeg = can_convert()

        # get added NyMediaFile
        for x in meta:
            if x.getLocalProperty("title", "en") == "media1":
                meta = x
            if x.getLocalProperty("title", "fr") == "media1_fr":
                meta_fr = x

        self.assertEqual(meta.getLocalProperty("title", "en"), "media1")
        self.assertEqual(meta_fr.getLocalProperty("title", "fr"), "media1_fr")

        # change NyMediaFile title
        meta.saveProperties(title="media1_edited", lang="en")
        meta_fr.saveProperties(title="media1_fr_edited", lang="fr")

        self.assertEqual(meta.getLocalProperty("title", "en"), "media1_edited")
        self.assertEqual(meta_fr.getLocalProperty("title", "fr"), "media1_fr_edited")

        # delete NyMediafile
        self._portal().info.manage_delObjects([meta.id])
        self._portal().info.manage_delObjects([meta_fr.id])

        meta = self._portal().getCatalogedObjectsCheckView(meta_type=["Naaya Media File"])
        self.assertEqual(meta, [])
コード例 #3
0
ファイル: testContentType.py プロジェクト: bogtan/Naaya
    def test_upload(self):
        addNyMediaFile(self._portal().info, id='media1', title='media1', lang='en', _skip_videofile_check=True)
        meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Media File'])[0]
        f = self.loadFile('data/square.flv')
        f.headers = {'content-type': 'application/x-flash-video'}
        meta.handleMediaUpload(f)
        self.assertEqual(meta.getLocalProperty('title', 'en'), 'media1')
        
        if can_convert():
            self._test_with_coverter(meta)
        else:
            self.assertEqual(self.loadFile('data/square.flv').read(), meta.get_data())

        self._portal().info.manage_delObjects([meta.id])
        meta = self._portal().getCatalogedObjectsCheckView(meta_type=['Naaya Media File'])
        self.assertEqual(meta, [])
コード例 #4
0
    def test_main(self):
        """ Add, Find, Edit and Delete Naaya Media Files """
        #add NyMediaFile
        addNyMediaFile(self._portal().info,
                       id='media1',
                       title='media1',
                       lang='en',
                       _skip_videofile_check=True)
        addNyMediaFile(self._portal().info,
                       id='media1_fr',
                       title='media1_fr',
                       lang='fr',
                       _skip_videofile_check=True)

        meta = self._portal().getCatalogedObjectsCheckView(
            meta_type=['Naaya Media File'])

        ffmpeg = can_convert()

        #get added NyMediaFile
        for x in meta:
            if x.getLocalProperty('title', 'en') == 'media1':
                meta = x
            if x.getLocalProperty('title', 'fr') == 'media1_fr':
                meta_fr = x

        self.assertEqual(meta.getLocalProperty('title', 'en'), 'media1')
        self.assertEqual(meta_fr.getLocalProperty('title', 'fr'), 'media1_fr')

        #change NyMediaFile title
        meta.saveProperties(title='media1_edited', lang='en')
        meta_fr.saveProperties(title='media1_fr_edited', lang='fr')

        self.assertEqual(meta.getLocalProperty('title', 'en'), 'media1_edited')
        self.assertEqual(meta_fr.getLocalProperty('title', 'fr'),
                         'media1_fr_edited')

        #delete NyMediafile
        self._portal().info.manage_delObjects([meta.id])
        self._portal().info.manage_delObjects([meta_fr.id])

        meta = self._portal().getCatalogedObjectsCheckView(
            meta_type=['Naaya Media File'])
        self.assertEqual(meta, [])