From 489b918e61dc8ea6ab5a70a4be191a403e53cf8e Mon Sep 17 00:00:00 2001 From: Francisco Aranda Date: Fri, 21 Jun 2024 15:12:19 +0200 Subject: [PATCH] tests: Add tests covering the case --- .../tests/unit/search_engine/test_commons.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/argilla-server/tests/unit/search_engine/test_commons.py b/argilla-server/tests/unit/search_engine/test_commons.py index ecba3232a6..b1ad061cc1 100644 --- a/argilla-server/tests/unit/search_engine/test_commons.py +++ b/argilla-server/tests/unit/search_engine/test_commons.py @@ -1100,6 +1100,26 @@ async def test_update_record_response( }, } + async def test_update_record_response_without_user_id( + self, + search_engine: BaseElasticAndOpenSearchEngine, + opensearch: OpenSearch, + test_banking_sentiment_dataset: Dataset, + ): + record = test_banking_sentiment_dataset.records[0] + question = test_banking_sentiment_dataset.questions[0] + + response = await ResponseFactory.create(record=record, values={question.name: {"value": "test"}}, user=None) + record = await response.awaitable_attrs.record + await record.awaitable_attrs.dataset + await search_engine.update_record_response(response) + + index_name = es_index_name_for_dataset(test_banking_sentiment_dataset) + + results = opensearch.get(index=index_name, id=record.id) + + assert results["_source"]["responses"] == {} + @pytest.mark.parametrize("annotators_size", [20, 200, 400]) async def test_annotators_limits( self,