mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-11 22:09:44 +00:00
feat: (0.6)New UI (#1855)
Co-authored-by: 夏姜 <wenfengjiang.jwf@digital-engine.com> Co-authored-by: aries_ckt <916701291@qq.com> Co-authored-by: wb-lh513319 <wb-lh513319@alibaba-inc.com> Co-authored-by: csunny <cfqsunny@163.com>
This commit is contained in:
78
dbgpt/serve/feedback/tests/test_service.py
Normal file
78
dbgpt/serve/feedback/tests/test_service.py
Normal file
@@ -0,0 +1,78 @@
|
||||
from typing import List
|
||||
|
||||
import pytest
|
||||
|
||||
from dbgpt.component import SystemApp
|
||||
from dbgpt.serve.core.tests.conftest import system_app
|
||||
from dbgpt.storage.metadata import db
|
||||
|
||||
from ..api.schemas import ServeRequest, ServerResponse
|
||||
from ..models.models import ServeEntity
|
||||
from ..service.service import Service
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup_and_teardown():
|
||||
db.init_db("sqlite:///:memory:")
|
||||
db.create_all()
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def service(system_app: SystemApp):
|
||||
instance = Service(system_app)
|
||||
instance.init_app(system_app)
|
||||
return instance
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def default_entity_dict():
|
||||
# TODO: build your default entity dict
|
||||
return {}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"system_app",
|
||||
[{"app_config": {"DEBUG": True, "dbgpt.serve.test_key": "hello"}}],
|
||||
indirect=True,
|
||||
)
|
||||
def test_config_exists(service: Service):
|
||||
system_app: SystemApp = service._system_app
|
||||
assert system_app.config.get("DEBUG") is True
|
||||
assert system_app.config.get("dbgpt.serve.test_key") == "hello"
|
||||
assert service.config is not None
|
||||
|
||||
|
||||
def test_service_create(service: Service, default_entity_dict):
|
||||
# TODO: implement your test case
|
||||
# eg. entity: ServerResponse = service.create(ServeRequest(**default_entity_dict))
|
||||
# ...
|
||||
pass
|
||||
|
||||
|
||||
def test_service_update(service: Service, default_entity_dict):
|
||||
# TODO: implement your test case
|
||||
pass
|
||||
|
||||
|
||||
def test_service_get(service: Service, default_entity_dict):
|
||||
# TODO: implement your test case
|
||||
pass
|
||||
|
||||
|
||||
def test_service_delete(service: Service, default_entity_dict):
|
||||
# TODO: implement your test case
|
||||
pass
|
||||
|
||||
|
||||
def test_service_get_list(service: Service):
|
||||
# TODO: implement your test case
|
||||
pass
|
||||
|
||||
|
||||
def test_service_get_list_by_page(service: Service):
|
||||
# TODO: implement your test case
|
||||
pass
|
||||
|
||||
|
||||
# Add more test cases according to your own logic
|
Reference in New Issue
Block a user