示例#1
0
文件: tests.py 项目: Tuss4/trickfeed
 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
0
文件: tests.py 项目: Tuss4/trickfeed
 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())
示例#3
0
文件: tests.py 项目: Tuss4/trickfeed
 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))
示例#4
0
文件: tests.py 项目: Tuss4/trickfeed
 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))
示例#5
0
文件: tests.py 项目: Tuss4/trickfeed
 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))
示例#6
0
文件: tests.py 项目: Tuss4/trickfeed
 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())
示例#7
0
文件: tests.py 项目: Tuss4/trickfeed
 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())
示例#8
0
文件: tests.py 项目: Tuss4/trickfeed
 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))
示例#9
0
文件: tests.py 项目: Tuss4/trickfeed
 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))
示例#10
0
文件: tests.py 项目: Tuss4/trickfeed
 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()))
示例#11
0
文件: tests.py 项目: Tuss4/trickfeed
 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()]))
示例#12
0
文件: tests.py 项目: Tuss4/trickfeed
 def test_get_index_name(self):
     self.assertEqual(Video.get_index_name(), 'test_trickapi_video_index')
示例#13
0
文件: tests.py 项目: Tuss4/trickfeed
 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))
示例#14
0
文件: tests.py 项目: Tuss4/trickfeed
 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()))
示例#15
0
文件: tests.py 项目: Tuss4/trickfeed
 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()]))
示例#16
0
文件: tests.py 项目: Tuss4/trickfeed
 def test_get_index_name(self):
     self.assertEqual(
         Video.get_index_name(), 'test_trickapi_video_index')