Adding tests for indexing strings via bulk helpers

This commit is contained in:
Honza Král
2015-10-11 05:00:14 +02:00
parent 1378073e2d
commit 9d415fadef
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ def expand_action(data):
"""
# when given a string, assume user wants to index raw json
if isinstance(data, string_types):
return '{"index": {}}', data
return '{"index":{}}', data
# make sure we don't alter the action
data = data.copy()
+4
View File
@@ -36,3 +36,7 @@ class TestChunkActions(TestCase):
def test_chunks_are_chopped_by_chunk_size(self):
self.assertEquals(10, len(list(helpers._chunk_actions(self.actions, 10, 99999999, JSONSerializer()))))
class TestExpandActions(TestCase):
def test_string_actions_are_marked_as_simple_inserts(self):
self.assertEquals(('{"index":{}}', "whatever"), helpers.expand_action('whatever'))