Skip to main content
Glama
test_api.py2.19 kB
"""Integration tests for API endpoints.""" import pytest from httpx import AsyncClient class TestHealthEndpoint: """Test cases for health check endpoint.""" @pytest.mark.asyncio async def test_health_check(self, client: AsyncClient): """Test health check returns OK.""" response = await client.get("/api/v1/health") assert response.status_code == 200 data = response.json() assert data["status"] == "healthy" class TestRootEndpoint: """Test cases for root endpoint.""" @pytest.mark.asyncio async def test_root(self, client: AsyncClient): """Test root endpoint returns API info.""" response = await client.get("/") assert response.status_code == 200 data = response.json() assert "name" in data assert "version" in data class TestDocumentsEndpoint: """Test cases for documents endpoints.""" @pytest.mark.asyncio async def test_list_documents(self, client: AsyncClient): """Test listing documents.""" response = await client.get("/api/v1/documents") assert response.status_code == 200 data = response.json() assert "items" in data or isinstance(data, list) @pytest.mark.asyncio async def test_create_document_no_auth(self, client: AsyncClient): """Test creating document without auth.""" response = await client.post( "/api/v1/documents", json={"name": "Test Document"} ) # Should work or return 401 depending on auth config assert response.status_code in [200, 201, 401, 422] @pytest.mark.asyncio async def test_get_document_not_found(self, client: AsyncClient): """Test getting non-existent document.""" response = await client.get("/api/v1/documents/non-existent-id") assert response.status_code == 404 class TestTemplatesEndpoint: """Test cases for templates endpoints.""" @pytest.mark.asyncio async def test_list_templates(self, client: AsyncClient): """Test listing templates.""" response = await client.get("/api/v1/templates") assert response.status_code == 200

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Fu-Jie/MCP-OPENAPI-DOCX'

If you have feedback or need assistance with the MCP directory API, please join our Discord server