File tree Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,7 @@ def send_request(
6565 data = (
6666 json .dumps (body , cls = serializer )
6767 if serialize_body
68- else ""
69- if body == ""
70- else "null"
68+ else "" if body == "" else "null"
7169 )
7270
7371 request = http_method (
Original file line number Diff line number Diff line change 11import pytest
22
3- from meilisearch .errors import MeilisearchApiError
43from tests .common import INDEX_UID
5- from tests .conftest import index_with_documents
64
75
8- def test_basic_multi_search (client , index_with_documents ):
9- """Delete the document with id."""
6+ @pytest .mark .usefixtures ("enable_edit_documents_by_function" )
7+ def test_update_document_by_function (client , index_with_documents ):
8+ """Delete the document with id and update document title"""
109 index_with_documents ()
1110 response = client .update_documents_by_function (
12- "indexA" ,
11+ INDEX_UID ,
1312 {"function" : 'if doc.id == "522681" {doc = () } else {doc.title = `* ${doc.title} *`}' },
1413 )
1514
1615 assert isinstance (response , dict )
16+ assert isinstance (response ["taskUid" ], int )
1717 assert response ["indexUid" ] == INDEX_UID
Original file line number Diff line number Diff line change @@ -230,6 +230,23 @@ def enable_vector_search():
230230 )
231231
232232
233+ @fixture
234+ def enable_edit_documents_by_function ():
235+ requests .patch (
236+ f"{ common .BASE_URL } /experimental-features" ,
237+ headers = {"Authorization" : f"Bearer { common .MASTER_KEY } " },
238+ json = {"editDocumentsByFunction" : True },
239+ timeout = 10 ,
240+ )
241+ yield
242+ requests .patch (
243+ f"{ common .BASE_URL } /experimental-features" ,
244+ headers = {"Authorization" : f"Bearer { common .MASTER_KEY } " },
245+ json = {"editDocumentsByFunction" : False },
246+ timeout = 10 ,
247+ )
248+
249+
233250@fixture
234251def new_embedders ():
235252 return {
You can’t perform that action at this time.
0 commit comments