MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / test_auth_flow_invalid_key

Function test_auth_flow_invalid_key

tests/integration/test_auth_flow.py:40–52  ·  view source on GitHub ↗

Test authentication flow with invalid API key.

()

Source from the content-addressed store, hash-verified

38
39@pytest.mark.vcr()
40def test_auth_flow_invalid_key():
41 """Test authentication flow with invalid API key."""
42 with patch("agentops.client.client.ApiClient") as mock_api_client:
43 # Create mock API instance that raises an error
44 mock_api = MagicMock()
45 mock_api.v3.fetch_auth_token.side_effect = ApiServerException("Invalid API key")
46 mock_api_client.return_value = mock_api
47
48 client = Client()
49 with pytest.raises((InvalidApiKeyException, ApiServerException)) as exc_info:
50 client.init(api_key="invalid-key")
51
52 assert "Invalid API key" in str(exc_info.value)

Callers

nothing calls this directly

Calls 3

initMethod · 0.95
ApiServerExceptionClass · 0.90
ClientClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…