Added new test case for bulk delete with single item (#878)

Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
This commit is contained in:
Harshil Jani
2024-12-29 18:27:01 +05:30
committed by GitHub
parent 4091816f84
commit 4cdf81e741
@@ -110,6 +110,18 @@ class TestBulk(OpenSearchTestCase):
self.assertFalse(response["errors"])
self.assertEqual(1, len(response["items"]))
def test_bulk_works_with_delete(self) -> None:
docs = '{ "index" : { "_index" : "bulk_test_index", "_id" : "1" } }\n{"answer": 42}\n{ "delete" : { "_index" : "bulk_test_index", "_id": "1" } }'
response = self.client.bulk(body=docs)
self.assertFalse(response["errors"])
self.assertEqual(2, len(response["items"]))
# Check insertion status
self.assertEqual(201, response["items"][0]["index"]["status"])
# Check deletion status
self.assertEqual(200, response["items"][1]["delete"]["status"])
class TestClose(OpenSearchTestCase):
def test_close_doesnt_break_client(self) -> None: