Skip to content

Commit

Permalink
Add tests for api version checking
Browse files Browse the repository at this point in the history
  • Loading branch information
WieslerTNG committed Jan 10, 2024
1 parent f985276 commit e78e4ff
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@
from tests.common import model_name, sync_client, async_client


def test_api_version_mismatch_client(httpserver: HTTPServer):
httpserver.expect_request("/version").respond_with_data("0.0.0")

with pytest.raises(RuntimeError):
Client(host=httpserver.url_for(""), token="AA_TOKEN")


async def test_api_version_mismatch_async_client(httpserver: HTTPServer):
httpserver.expect_request("/version").respond_with_data("0.0.0")

with pytest.raises(RuntimeError):
async with AsyncClient(host=httpserver.url_for(""), token="AA_TOKEN"):
pass


def test_api_version_correct_client(httpserver: HTTPServer):
httpserver.expect_request("/version").respond_with_data(MIN_API_VERSION)
Client(host=httpserver.url_for(""), token="AA_TOKEN")


async def test_api_version_correct_async_client(httpserver: HTTPServer):
httpserver.expect_request("/version").respond_with_data(MIN_API_VERSION)
async with AsyncClient(host=httpserver.url_for(""), token="AA_TOKEN"):
pass


@pytest.mark.system_test
async def test_can_use_async_client_without_context_manager(model_name: str):
request = CompletionRequest(
Expand Down

0 comments on commit e78e4ff

Please sign in to comment.