We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/wwiens/trakt_mcpserver'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
test_auth_resources.py•1.26 KiB
import sys
import time
from pathlib import Path
from unittest.mock import patch
import pytest
sys.path.append(str(Path(__file__).parent.parent.parent.parent))
from server.auth.resources import get_auth_status
@pytest.mark.asyncio
async def test_get_auth_status_authenticated():
with patch("server.auth.resources.AuthClient") as mock_client_class:
mock_client = mock_client_class.return_value
mock_client.is_authenticated.return_value = True
mock_client.get_token_expiry.return_value = (
int(time.time()) + 3600
) # 1 hour from now
result = await get_auth_status()
assert "You are authenticated with Trakt" in result
mock_client.is_authenticated.assert_called_once()
mock_client.get_token_expiry.assert_called_once()
@pytest.mark.asyncio
async def test_get_auth_status_not_authenticated():
with patch("server.auth.resources.AuthClient") as mock_client_class:
mock_client = mock_client_class.return_value
mock_client.is_authenticated.return_value = False
result = await get_auth_status()
assert "You are not authenticated with Trakt" in result
mock_client.is_authenticated.assert_called_once()
mock_client.get_token_expiry.assert_not_called()