Initial vLLM agent strategy
This commit is contained in:
38
tests/test_submit_result_mapping.py
Normal file
38
tests/test_submit_result_mapping.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from app.clients.modelhub import ModelHubClient
|
||||
from app.settings import Settings
|
||||
|
||||
|
||||
class FakeResponse:
|
||||
def __init__(self, body):
|
||||
self.body = body
|
||||
def json(self):
|
||||
return self.body
|
||||
|
||||
|
||||
class FakeSession:
|
||||
def __init__(self, body):
|
||||
self.body = body
|
||||
def post(self, *args, **kwargs):
|
||||
return FakeResponse(self.body)
|
||||
|
||||
|
||||
def make_client(body):
|
||||
settings = Settings(
|
||||
auth_token="a", hf_token="h", contest_api_token="c", email="e", user_id="1",
|
||||
contributors="u", strategy_id="s", submit_dry_run=False
|
||||
)
|
||||
client = ModelHubClient(settings)
|
||||
client.session = FakeSession(body)
|
||||
return client
|
||||
|
||||
|
||||
def test_submit_success_mapping():
|
||||
assert make_client({"code": 0, "message": "ok"}).create_contest_task("m", "hygon_k100-ai", "cfg").result == "success"
|
||||
|
||||
|
||||
def test_submit_queue_full_mapping():
|
||||
assert make_client({"code": 60007, "message": "full"}).create_contest_task("m", "hygon_k100-ai", "cfg").result == "queue_full"
|
||||
|
||||
|
||||
def test_submit_conflict_mapping():
|
||||
assert make_client({"code": 40000, "message": "正在验证中"}).create_contest_task("m", "hygon_k100-ai", "cfg").result == "conflict"
|
||||
Reference in New Issue
Block a user