def test_callback_new(self):
     on_new = mock.Mock()
     with SearchIndexingBufferedSender("endpoint", "index name", CREDENTIAL, auto_flush=False, on_new=on_new) as client:
         client.upload_documents(["upload1"])
         assert on_new.called
 def test_process_if_needed(self, mock_process_if_needed):
     with SearchIndexingBufferedSender("endpoint", "index name", CREDENTIAL) as client:
         client.upload_documents(["upload1"])
         client.delete_documents(["delete1", "delete2"])
     assert mock_process_if_needed.called
 def test_context_manager(self, mock_cleanup):
     with SearchIndexingBufferedSender("endpoint", "index name", CREDENTIAL, auto_flush=False) as client:
         client.upload_documents(["upload1"])
         client.delete_documents(["delete1", "delete2"])
     assert mock_cleanup.called
 def test_search_indexing_buffered_sender_kwargs(self):
     with SearchIndexingBufferedSender("endpoint", "index name", CREDENTIAL, window=100) as client:
         assert client._batch_action_count == 512
         assert client._max_retries_per_action == 3
         assert client._auto_flush_interval == 60
         assert client._auto_flush