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

Function test_get_token_server_error

app/api/tests/v3/test_jwt_generation.py:62–72  ·  view source on GitHub ↗

Test handling of server errors in token generation

(async_app_client)

Source from the content-addressed store, hash-verified

60
61@pytest.mark.asyncio
62async def test_get_token_server_error(async_app_client):
63 """Test handling of server errors in token generation"""
64 # Mock the ProjectModel.get_by_api_key method to raise an exception
65 with patch.object(ProjectModel, 'get_by_api_key', side_effect=Exception("Database error")):
66 response = await async_app_client.post(
67 "/v3/auth/token",
68 json={"api_key": "11111111-1111-1111-1111-111111111111"}
69 )
70
71 assert response.status_code == 500
72 assert "Authentication failed" in response.json()["error"]

Callers

nothing calls this directly

Calls 2

jsonMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…