Adding tests for indexing strings via bulk helpers
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user