delete_dataset method and tests created (#1186)

### What problem does this PR solve?

This PR have completed both HTTP API and Python SDK for
'delete_dataset". In addition, there are tests for it.

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
cecilia-uu
2024-06-17 15:10:05 +08:00
committed by GitHub
parent 1eb4caf02a
commit 6be3626372
3 changed files with 77 additions and 7 deletions

View File

@ -101,6 +101,21 @@ class TestDataset(TestSdk):
_, res = response
assert "IndexError" in res['message']
def test_delete_one_dataset_with_success(self):
# get the real name of the created dataset
ragflow = RAGFlow(API_KEY, HOST_ADDRESS)
res = ragflow.create_dataset("kb0")
real_dataset_name = res['data']['dataset_name']
print("name", real_dataset_name)
# delete this dataset
result = ragflow.delete_dataset(real_dataset_name)
print(result)
assert result["success"] is True
def test_delete_dataset_with_not_existing_dataset(self):
ragflow = RAGFlow(API_KEY, HOST_ADDRESS)
res = ragflow.delete_dataset("weird_dataset")
assert res["success"] is False