Пример #1
0
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 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
 def test_get_index_name(self):
     self.assertEqual(Video.get_index_name(), 'test_trickapi_video_index')
Пример #13
0
 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
 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
 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
 def test_get_index_name(self):
     self.assertEqual(
         Video.get_index_name(), 'test_trickapi_video_index')