Moved helpers unit tests to test_helpers
This commit is contained in:
@@ -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,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):
|
||||
|
||||
Reference in New Issue
Block a user