Skip to content

Commit 85c7783

Browse files
committed
chore: Add unit test cases
1 parent a4f0f25 commit 85c7783

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

packages/toolbox-core/tests/test_client.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,35 @@ async def test_constructor_getters_missing_fail(self, tool_name, client):
398398
await client.load_tool(tool_name, auth_token_getters={AUTH_SERVICE: {}})
399399

400400

401+
@pytest.mark.asyncio
402+
async def test_add_auth_token_getters_missing_fail(self, tool_name, client):
403+
"""
404+
Tests that adding a missing auth token getter raises ValueError.
405+
"""
406+
AUTH_SERVICE = "xmy-auth-service"
407+
408+
tool = await client.load_tool(tool_name)
409+
410+
with pytest.raises(
411+
ValueError,
412+
match=f"Authentication source\(s\) \`{AUTH_SERVICE}\` unused by tool \`{tool_name}\`.",
413+
):
414+
tool.add_auth_token_getters({AUTH_SERVICE: {}})
415+
416+
@pytest.mark.asyncio
417+
async def test_constructor_getters_missing_fail(self, tool_name, client):
418+
"""
419+
Tests that adding a missing auth token getter raises ValueError.
420+
"""
421+
AUTH_SERVICE = "xmy-auth-service"
422+
423+
with pytest.raises(
424+
ValueError,
425+
match=f"Validation failed for tool '{tool_name}': unused auth tokens: {AUTH_SERVICE}.",
426+
):
427+
await client.load_tool(tool_name, auth_token_getters={AUTH_SERVICE: {}})
428+
429+
401430
class TestBoundParameter:
402431

403432
@pytest.fixture

0 commit comments

Comments
 (0)