Moved helpers unit tests to test_helpers

This commit is contained in:
Honza Král
2015-10-11 04:50:31 +02:00
parent 12c2a466e1
commit 1378073e2d
2 changed files with 12 additions and 14 deletions
+11
View File
@@ -3,6 +3,7 @@ import time
import threading
from elasticsearch import helpers, Elasticsearch
from elasticsearch.serializer import JSONSerializer
from .test_cases import TestCase
@@ -25,3 +26,13 @@ class TestParallelBulk(TestCase):
self.assertTrue(len(set([r[1] for r in results])) > 1)
class TestChunkActions(TestCase):
def setUp(self):
super(TestChunkActions, self).setUp()
self.actions = [({'index': {}}, {'some': 'data', 'i': i}) for i in range(100)]
def test_chunks_are_chopped_by_byte_size(self):
self.assertEquals(100, len(list(helpers._chunk_actions(self.actions, 100000, 1, JSONSerializer()))))
def test_chunks_are_chopped_by_chunk_size(self):
self.assertEquals(10, len(list(helpers._chunk_actions(self.actions, 10, 99999999, JSONSerializer()))))
+1 -14
View File
@@ -1,20 +1,7 @@
from elasticsearch import helpers, TransportError
from elasticsearch.serializer import JSONSerializer
from . import ElasticsearchTestCase
from ..test_cases import SkipTest, TestCase
class TestChunkActions(TestCase):
def setUp(self):
super(TestChunkActions, self).setUp()
self.actions = [({'index': {}}, {'some': 'data', 'i': i}) for i in range(100)]
def test_chunks_are_chopped_by_byte_size(self):
self.assertEquals(100, len(list(helpers._chunk_actions(self.actions, 100000, 1, JSONSerializer()))))
def test_chunks_are_chopped_by_chunk_size(self):
self.assertEquals(10, len(list(helpers._chunk_actions(self.actions, 10, 99999999, JSONSerializer()))))
from ..test_cases import SkipTest
class FailingBulkClient(object):