Skip to content

Commit

Permalink
Added new test case for bulk delete with single item (#878)
Browse files Browse the repository at this point in the history
Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>
  • Loading branch information
Harshil-Jani authored Dec 29, 2024
1 parent 4091816 commit 4cdf81e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test_opensearchpy/test_server/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ def test_bulk_works_with_bytestring_body(self) -> None:
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:
Expand Down

0 comments on commit 4cdf81e

Please sign in to comment.