def test_proper_bulk_body_as_string_is_not_modified(self): string_body = '"{"index":{ "_index" : "test"}}\n{"field1": "value1"}"\n' self.assertEqual(string_body, _bulk_body(None, string_body))
def test_bulk_body_as_bytestring_adds_trailing_newline(self): bytestring_body = b'"{"index":{ "_index" : "test"}}\n{"field1": "value1"}"' self.assertEqual( b'"{"index":{ "_index" : "test"}}\n{"field1": "value1"}"\n', _bulk_body(None, bytestring_body), )