Skip to content

Commit 538b384

Browse files
committed
chore: Add e2e test case
1 parent 17d7f85 commit 538b384

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/toolbox-core/tests/test_e2e.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,20 @@ async def test_run_tool_auth(self, toolbox: ToolboxClient, auth_token1: str):
166166
response = await auth_tool(id="2")
167167
assert "row2" in response
168168

169+
@pytest.mark.asyncio
170+
async def test_run_tool_async_auth(toolbox: ToolboxClient, auth_token1: str):
171+
"""Tests running a tool with correct auth using an async token getter."""
172+
tool = await toolbox.load_tool("get-row-by-id-auth")
173+
174+
async def get_token_asynchronously():
175+
return auth_token1
176+
177+
auth_tool = tool.add_auth_token_getters(
178+
{"my-test-auth": get_token_asynchronously}
179+
)
180+
response = await auth_tool(id="2")
181+
assert "row2" in response
182+
169183
async def test_run_tool_param_auth_no_auth(self, toolbox: ToolboxClient):
170184
"""Tests running a tool with a param requiring auth, without auth."""
171185
tool = await toolbox.load_tool("get-row-by-email-auth")

0 commit comments

Comments
 (0)