Add tests for frontend API (#3552)

### What problem does this PR solve?

Add tests for frontend API

### Type of change

- [x] New Feature (non-breaking change which adds functionality)

---------

Co-authored-by: liuhua <10215101452@stu.ecun.edu.cn>
This commit is contained in:
liuhua
2024-11-21 15:39:25 +08:00
committed by GitHub
parent 85dd9fde43
commit bf9ebda3c8
23 changed files with 75 additions and 30 deletions

View File

@ -0,0 +1,2 @@
import os
HOST_ADDRESS=os.getenv('HOST_ADDRESS', 'http://127.0.0.1:9380')

View File

@ -0,0 +1,3 @@
def test_get_email(get_email):
print(f"\nEmail account:",flush=True)
print(f"{get_email}\n",flush=True)

View File

@ -0,0 +1,10 @@
from common import HOST_ADDRESS
import requests
def test_create_dataset(get_auth):
authorization={"Authorization": get_auth}
url = f"{HOST_ADDRESS}/v1/kb/create"
json = {"name":"test_create_dataset"}
res = requests.post(url=url,headers=authorization,json=json)
res = res.json()
assert res.get("code") == 0,f"{res.get('message')}"