Skip to content

Commit 3b08d41

Browse files
committed
test: add test
1 parent 8844365 commit 3b08d41

File tree

1 file changed

+47
-42
lines changed

1 file changed

+47
-42
lines changed

test/testcase/test_sync/test_sync_retrieval.py

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -248,50 +248,55 @@ def test_update_record_by_text(self, collection_id, record_id, text_splitter):
248248
res = update_record(**update_record_data)
249249
res_dict = vars(res)
250250
assume_record_result(update_record_data, res_dict)
251+
time.sleep(2)
251252
records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, before=None)
252253

253-
# @pytest.mark.run(order=34)
254-
# @pytest.mark.parametrize("text_splitter", text_splitter_list)
255-
# def test_update_record_by_web(self, collection_id, record_id, text_splitter):
256-
# # Update a record.
257-
#
258-
# update_record_data = {
259-
# "type": "web",
260-
# "title": "TaskingAI",
261-
# "collection_id": collection_id,
262-
# "record_id": record_id,
263-
# "url": "https://docs.tasking.ai/docs/guide/getting_started/overview/",
264-
# "text_splitter": text_splitter,
265-
# "metadata": {"test": "test"},
266-
# }
267-
# res = update_record(**update_record_data)
268-
# res_dict = vars(res)
269-
# assume_record_result(update_record_data, res_dict)
270-
#
271-
# @pytest.mark.run(order=35)
272-
# @pytest.mark.parametrize("upload_file_data", upload_file_data_list[2:3])
273-
# def test_update_record_by_file(self, collection_id, record_id, upload_file_data):
274-
# # upload file
275-
# upload_file_res = upload_file(**upload_file_data)
276-
# upload_file_dict = vars(upload_file_res)
277-
# file_id = upload_file_dict["file_id"]
278-
# pytest.assume(file_id is not None)
279-
#
280-
# # Update a record.
281-
# text_splitter = TokenTextSplitter(chunk_size=200, chunk_overlap=20)
282-
#
283-
# update_record_data = {
284-
# "type": "file",
285-
# "title": "TaskingAI",
286-
# "collection_id": collection_id,
287-
# "record_id": record_id,
288-
# "file_id": file_id,
289-
# "text_splitter": text_splitter,
290-
# "metadata": {"test": "test"},
291-
# }
292-
# res = update_record(**update_record_data)
293-
# res_dict = vars(res)
294-
# assume_record_result(update_record_data, res_dict)
254+
@pytest.mark.run(order=34)
255+
@pytest.mark.parametrize("text_splitter", text_splitter_list)
256+
def test_update_record_by_web(self, collection_id, record_id, text_splitter):
257+
# Update a record.
258+
259+
update_record_data = {
260+
"type": "web",
261+
"title": "TaskingAI",
262+
"collection_id": collection_id,
263+
"record_id": record_id,
264+
"url": "https://docs.tasking.ai/docs/guide/getting_started/overview/",
265+
"text_splitter": text_splitter,
266+
"metadata": {"test": "test"},
267+
}
268+
res = update_record(**update_record_data)
269+
res_dict = vars(res)
270+
assume_record_result(update_record_data, res_dict)
271+
time.sleep(2)
272+
records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, before=None)
273+
274+
@pytest.mark.run(order=35)
275+
@pytest.mark.parametrize("upload_file_data", upload_file_data_list[2:3])
276+
def test_update_record_by_file(self, collection_id, record_id, upload_file_data):
277+
# upload file
278+
upload_file_res = upload_file(**upload_file_data)
279+
upload_file_dict = vars(upload_file_res)
280+
file_id = upload_file_dict["file_id"]
281+
pytest.assume(file_id is not None)
282+
283+
# Update a record.
284+
text_splitter = TokenTextSplitter(chunk_size=200, chunk_overlap=20)
285+
286+
update_record_data = {
287+
"type": "file",
288+
"title": "TaskingAI",
289+
"collection_id": collection_id,
290+
"record_id": record_id,
291+
"file_id": file_id,
292+
"text_splitter": text_splitter,
293+
"metadata": {"test": "test"},
294+
}
295+
res = update_record(**update_record_data)
296+
res_dict = vars(res)
297+
assume_record_result(update_record_data, res_dict)
298+
time.sleep(2)
299+
records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, before=None)
295300

296301
@pytest.mark.run(order=79)
297302
def test_delete_record(self, collection_id):

0 commit comments

Comments
 (0)