Test authentication flow with invalid API key.
()
| 38 | |
| 39 | @pytest.mark.vcr() |
| 40 | def 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) |
nothing calls this directly
no test coverage detected
searching dependent graphs…