Beispiel #1
0
 def test_delete(self):
     video = Video(filename='bears.mov', name='DELETE TEST The Bears',
         short_description='Opening roll for an exciting soccer match.')
     video.tags.append('unittest')
     video.save()
     video.delete()
     self.assertEquals(video.id, None)
Beispiel #2
0
 def test_get_upload_status(self):
     video = Video(filename='bears.mov', name='STATUS TEST The Bears',
         short_description='Opening roll for an exciting soccer match.')
     video.tags.append('unittest')
     video.save()
     status = video.get_upload_status()
     self.assertEquals(status, enums.UploadStatusEnum.PROCESSING)
Beispiel #3
0
 def test_save_update(self):
     video = Video(id=TEST_VIDEO_ID)
     video.tags.append('tag-%s' % self.test_uuid)
     video.tags.append('unittest')
     lmd = video.last_modified_date
     video.save()
     self.assertEquals(video.reference_id, TEST_VIDEO_REF_ID)
     self.assertNotEquals(video.last_modified_date, lmd)
    def test_batch_provision_video(self, OpenMockClass, GetSizeMockClass,
        Md5MockClass, FTPMockClass):
        o = OpenMockClass()
        o.read.return_value = None
        m = Md5MockClass()
        m.hexdigest.return_value = 'a78fa9f8asd'
        GetSizeMockClass.return_value = 10000
        f = FTPMockClass()

        ftp = FTPConnection(host='host',
                            user='******',
                            password='******',
                            publisher_id='111111111',
                            preparer='Patrick',
                            report_success=True)
        v = Video(name="Some title",
                  reference_id='a532kallk3252a',
                  short_description="A short description.",
                  connection=ftp)
        v.long_description = "An even longer description"
        v.tags.extend(["blah", "nah", "tag"])
        v.add_asset('1500.flv',
                enums.AssetTypeEnum.VIDEO_FULL, 'High quality rendition',
                encoding_rate=1500000, frame_width=640,
                frame_height=360)
        v.add_asset('700.flv',
                enums.AssetTypeEnum.VIDEO_FULL, 'Medium quality rendition',
                encoding_rate=700000, frame_width=640,
                frame_height=360)
        v.add_asset('poster.png',
                enums.AssetTypeEnum.VIDEO_STILL, 'Poster frame',
                frame_width=640, frame_height=360)
        v.save()

        self.assertEqual('login', f.method_calls[0][0])
        self.assertEqual('set_pasv', f.method_calls[1][0])
        self.assertEqual('storbinary', f.method_calls[2][0])
        self.assertEqual('STOR 1500.flv', f.method_calls[2][1][0])

        self.assertEqual('login', f.method_calls[3][0])
        self.assertEqual('set_pasv', f.method_calls[4][0])
        self.assertEqual('storbinary', f.method_calls[5][0])
        self.assertEqual('STOR 700.flv', f.method_calls[5][1][0])

        self.assertEqual('login', f.method_calls[6][0])
        self.assertEqual('set_pasv', f.method_calls[7][0])
        self.assertEqual('storbinary', f.method_calls[8][0])
        self.assertEqual('STOR poster.png', f.method_calls[8][1][0])

        self.assertEqual('write', o.method_calls[6][0])
        valid_xml = minidom.parse(
            open('test_ftp_video_batch_provision_manifest.xml', 'rb'))
        test_xml = minidom.parseString(o.method_calls[6][1][0])
        self.assertEqual(
            valid_xml.toxml().replace('\t', '').replace('\n', ''),
            test_xml.toxml().replace('\t', '').replace('\n', ''))
Beispiel #5
0
 def test_save_new(self):
     video = Video(filename='bears.mov', name='The Bears',
         short_description='Opening roll for an exciting soccer match.')
     video.tags.append('unittest')
     video.save()
     self.assertEquals(video.id not in (0, '', None), True)