本文整理汇总了Python中videos.models.Video.get_index_name方法的典型用法代码示例。如果您正苦于以下问题:Python Video.get_index_name方法的具体用法?Python Video.get_index_name怎么用?Python Video.get_index_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类videos.models.Video
的用法示例。
在下文中一共展示了Video.get_index_name方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delete_index
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import get_index_name [as 别名]
def test_delete_index(self):
app_config = apps.get_app_config('videos')
create_index(app_config, 'Video')
self.assertTrue(index_exists(Video.get_index_name()))
delete_index(Video.get_index_name())
with self.assertRaises(IndexNotFound):
get_index(Video.get_index_name())
示例2: test_get_document
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import get_index_name [as 别名]
def test_get_document(self):
app_config = apps.get_app_config('videos')
create_index(app_config, 'Video')
self.assertTrue(index_exists(Video.get_index_name()))
time.sleep(1)
v = Video.objects.create(
title="Test Video",
video_id="Leg1tVid1D",
thumbnail_url="http://example.com/legitthumbnail.jpeg")
doc = get_document(v)
self.assertTrue(isinstance(doc, dict))
示例3: test_create_document
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import get_index_name [as 别名]
def test_create_document(self):
app_config = apps.get_app_config('videos')
create_index(app_config, 'Video')
self.assertTrue(index_exists(Video.get_index_name()))
time.sleep(1)
v = Video.objects.create(
title="Test Video",
video_id="Leg1tVid1D",
thumbnail_url="http://example.com/legitthumbnail.jpeg")
# Created Via signal assert the document exists
doc = get_document(v)
self.assertEqual(doc['_source'], v.get_document_body())
示例4: test_create_document_conflict
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import get_index_name [as 别名]
def test_create_document_conflict(self):
app_config = apps.get_app_config('videos')
create_index(app_config, 'Video')
self.assertTrue(index_exists(Video.get_index_name()))
time.sleep(1)
v = Video.objects.create(
title="Test Video",
video_id="Leg1tVid1D",
thumbnail_url="http://example.com/legitthumbnail.jpeg")
err = create_document(v)
err_msg = "Conflict: document already exists for {0} with id {1}."
self.assertEqual(
err, err_msg.format(v.__class__.__name__, v.pk))
示例5: test_get_index
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import get_index_name [as 别名]
def test_get_index(self):
app_config = apps.get_app_config('videos')
create_index(app_config, 'Video')
self.assertTrue(index_exists(Video.get_index_name()))
index = get_index(Video.get_index_name())
self.assertTrue(isinstance(index, dict))
示例6: test_index_exists
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import get_index_name [as 别名]
def test_index_exists(self):
app_config = apps.get_app_config('videos')
create_index(app_config, 'Video')
self.assertTrue(index_exists(Video.get_index_name()))
示例7: test_create_index
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import get_index_name [as 别名]
def test_create_index(self):
app_config = apps.get_app_config('videos')
create_index(app_config, 'Video')
self.assertTrue(ES.indices.exists(index=[Video.get_index_name()]))
示例8: test_get_index_name
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import get_index_name [as 别名]
def test_get_index_name(self):
self.assertEqual(
Video.get_index_name(), 'test_trickapi_video_index')