Skip to main content
Glama
test_ingest.py2.65 kB
"""Tests for documentation ingestion.""" import tempfile from pathlib import Path import os from shopify_liquid_mcp.ingest import ( index_documentation, search_documentation, get_document, get_by_category, ) def test_indexing(): """Test that documentation can be indexed.""" # Use temporary database for testing with tempfile.TemporaryDirectory() as tmpdir: os.environ['SHOPIFY_LIQUID_DB_PATH'] = str(Path(tmpdir) / "test.db") # Index documentation count = index_documentation(force=True) # Should have indexed multiple documents assert count > 0, "No documents were indexed" assert count >= 150, f"Expected at least 150 documents, got {count}" def test_search(): """Test full-text search.""" with tempfile.TemporaryDirectory() as tmpdir: os.environ['SHOPIFY_LIQUID_DB_PATH'] = str(Path(tmpdir) / "test.db") # Index first index_documentation(force=True) # Search for "for loop" results = search_documentation(["for", "loop"]) assert len(results) > 0, "Search returned no results" # Check result structure assert 'name' in results[0] assert 'category' in results[0] assert 'content' in results[0] def test_get_document(): """Test getting a specific document.""" with tempfile.TemporaryDirectory() as tmpdir: os.environ['SHOPIFY_LIQUID_DB_PATH'] = str(Path(tmpdir) / "test.db") # Index first index_documentation(force=True) # Get the 'for' tag doc = get_document("tags", "for") assert doc is not None, "'for' tag not found" assert doc['name'] == 'for' assert doc['category'] == 'tags' assert len(doc['content']) > 0 def test_get_by_category(): """Test getting all documents in a category.""" with tempfile.TemporaryDirectory() as tmpdir: os.environ['SHOPIFY_LIQUID_DB_PATH'] = str(Path(tmpdir) / "test.db") # Index first index_documentation(force=True) # Get all tags tags = get_by_category("tags") assert len(tags) > 0, "No tags found" assert len(tags) >= 20, f"Expected at least 20 tags, got {len(tags)}" # Get all filters filters = get_by_category("filters") assert len(filters) > 0, "No filters found" assert len(filters) >= 80, f"Expected at least 80 filters, got {len(filters)}" # Get all objects objects = get_by_category("objects") assert len(objects) > 0, "No objects found" assert len(objects) >= 50, f"Expected at least 50 objects, got {len(objects)}"

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/florinel-chis/shopify-liquid-mcp'

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