@devries-cameron20 / composio-1 / commits / cd9ec1d59
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

test(python): cover missing API key recovery advice

Brendan O'Leary committed Nov 4, 2026 at 23:35 UTC cd9ec1d59841b5b98e8d8dbffc359346ed2d2fba
1 file changed +10 -2
python/tests/test_sdk.py
+10 -2
@@ -20,11 +20,19 @@ class TestComposioSDK:
20
21 @pytest.mark.parametrize("config", [{}, {"api_key": None}, {"api_key": ""}])
22 def test_sdk_requires_api_key(self, config):
23 - """Missing credentials must fail, not create an unauthenticated client."""
23 + """Missing credentials must explain SDK setup and the separate CLI install."""
24 with patch.dict(os.environ, {}, clear=True):
25 - with pytest.raises(exceptions.ApiKeyNotProvidedError):
25 + with pytest.raises(exceptions.ApiKeyNotProvidedError) as exc_info:
26 Composio(**config)
27
28 + message = str(exc_info.value)
29 + assert "COMPOSIO_API_KEY" in message
30 + assert "Composio(api_key=" in message
31 + assert "Optional: `composio login`" in message
32 + assert "requires installing the CLI separately" in message
33 + assert "https://docs.composio.dev/docs/cli#install" in message
34 + assert "does not set `COMPOSIO_API_KEY`" in message
35 +
36 @pytest.mark.parametrize("api_key", [None, ""])
37 def test_sdk_explicit_missing_api_key_does_not_fall_back_to_env(self, api_key):
38 """Only an omitted ``api_key`` falls back to COMPOSIO_API_KEY."""