本文整理汇总了Python中mediacore.model.Media.example方法的典型用法代码示例。如果您正苦于以下问题:Python Media.example方法的具体用法?Python Media.example怎么用?Python Media.example使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mediacore.model.Media
的用法示例。
在下文中一共展示了Media.example方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def setUp(self):
super(FilteringRestrictedItemsTest, self).setUp()
# without explicit re-registration of the default policy unit tests
# failed when running 'python setup.py test'
self._register_default_policy()
# get rid of default media
Media.query.delete()
self.private_media = Media.example(slug=u'private')
self.public_media = Media.example(slug=u'public')
self.permission_system = MediaCorePermissionSystem(self.pylons_config)
self.media_query = Media.query
user = self._create_user_without_groups()
self.perm = UserPermissions(user, self.permission_system)
示例2: test_sets_video_type_if_media_contains_audio_and_video_files
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def test_sets_video_type_if_media_contains_audio_and_video_files(self):
media = Media.example()
assert_none(media.type)
self.add_external_file(media, 'mp4')
self.add_external_file(media, 'mp3')
media.update_status()
assert_equals(VIDEO, media.type, message='did not detect mixed video/audio media as VIDEO type')
示例3: test_does_not_set_type_if_only_audio_description_files_are_attached
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def test_does_not_set_type_if_only_audio_description_files_are_attached(self, suffix):
media = Media.example()
assert_none(media.type)
media_file = self.add_external_file(media, suffix)
media_file.type = AUDIO_DESC
media.update_status()
assert_none(media.type, message='did detect media with audio description file as %s' % media.type)
示例4: test_can_create_example_media
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def test_can_create_example_media(self):
media = Media.example()
assert_not_none(media.id)
assert_equals(u'Foo Media', media.title)
assert_equals(u'foo-media', media.slug)
assert_equals(Author(u'Joe', u'[email protected]'), media.author)
assert_length(0, media.files)
assert_none(media.type)
assert_none(media.podcast_id)
assert_false(media.publishable)
assert_false(media.reviewed)
assert_false(media.encoded)
assert_none(media.publish_on)
assert_none(media.publish_until)
assert_false(media.is_published)
示例5: test_can_override_example_data
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def test_can_override_example_data(self):
media = Media.example(title=u'Bar Foo')
assert_equals(u'Bar Foo', media.title)
assert_equals(u'bar-foo', media.slug)
示例6: setUp
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def setUp(self):
super(MediaTest, self).setUp()
self.init_flowplayer()
self.media = Media.example()
self.encoding_event = self.create_spy_on_event(events.Media.encoding_done)
示例7: test_does_not_set_type_if_only_caption_files_are_attached
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def test_does_not_set_type_if_only_caption_files_are_attached(self, suffix):
media = Media.example()
assert_none(media.type)
self.add_external_file(media, suffix)
media.update_status()
assert_none(media.type, message='did detect media with caption file as %s' % media.type)
示例8: test_can_detect_audio_files
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def test_can_detect_audio_files(self, suffix):
media = Media.example()
assert_not_equals(AUDIO, media.type)
self.add_external_file(media, suffix)
media.update_status()
assert_equals(AUDIO, media.type, message='did not detect %s as AUDIO type' % suffix)
示例9: setUp
# 需要导入模块: from mediacore.model import Media [as 别名]
# 或者: from mediacore.model.Media import example [as 别名]
def setUp(self):
super(MediaStatusUpdatesTypeTest, self).setUp()
# prevent warning about missing handlers for logger
# "mediacore.model.players" ("fetch_enabled_players()")
self.init_flowplayer()
self.media = Media.example()