Skip to content

Commit

Permalink
quick test for client
Browse files Browse the repository at this point in the history
  • Loading branch information
jianshen92 committed Aug 23, 2023
1 parent 72cfc8b commit e21c6de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/e2e/bento_server_http/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ async def predict_text_stream(inp: str) -> t.AsyncGenerator[str, None]:
return stream_runner.count_text_stream.async_stream(inp)


@svc.api(
input=Text(),
output=Text(),
)
def yo(inp: str) -> str:
return f"yo {inp}"


# customise the service
class AllowPingMiddleware:
def __init__(
Expand Down
7 changes: 7 additions & 0 deletions tests/e2e/bento_server_http/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ def test_health(host: str) -> None:
resp = http_client.health()

assert resp.status == 200


def test_text_endpoint(host: str) -> None:
http_client = HTTPClient.from_url(f"http://{host}")
resp = http_client.yo("Bob")

assert resp == "yo Bob"

0 comments on commit e21c6de

Please sign in to comment.