test(A1.9): Add comprehensive E2E tests for git source features
Added 16 new E2E tests covering complete workflows: Core Git Operations (12 tests): - test_e2e_workflow_direct_git_url - Clone and fetch without registration - test_e2e_workflow_with_source_registration - Complete CRUD workflow - test_e2e_multiple_sources_priority_resolution - Multi-source management - test_e2e_pull_existing_repository - Pull updates from upstream - test_e2e_force_refresh - Delete and re-clone cache - test_e2e_config_not_found - Error handling with helpful messages - test_e2e_invalid_git_url - URL validation - test_e2e_source_name_validation - Name validation - test_e2e_registry_persistence - Cross-instance persistence - test_e2e_cache_isolation - Independent cache directories - test_e2e_auto_detect_token_env - Auto-detect GITHUB_TOKEN, GITLAB_TOKEN - test_e2e_complete_user_workflow - Real-world team collaboration scenario MCP Tools Integration (4 tests): - test_mcp_add_list_remove_source_e2e - All 3 source management tools - test_mcp_fetch_config_git_url_mode_e2e - fetch_config with direct git URL - test_mcp_fetch_config_source_mode_e2e - fetch_config with registered source - test_mcp_error_handling_e2e - Error cases for all 4 tools Test Features: - Uses temporary directories and actual git repositories - Tests with file:// URLs (no network required) - Validates all error messages - Tests registry persistence across instances - Tests cache isolation - Simulates team collaboration workflows All tests use real GitPython operations and validate: - Clone/pull with shallow clones - Config discovery and fetching - Source registry CRUD - Priority resolution - Token auto-detection - Error handling with helpful messages Fixed test_mcp_git_sources.py import error (moved TextContent import inside try/except) Test Results: 522 passed, 62 skipped (95 new tests added for A1.9) 🤖 Generated with Claude Code Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,14 +9,15 @@ import pytest
|
||||
import os
|
||||
from pathlib import Path
|
||||
from unittest.mock import AsyncMock, MagicMock, patch, Mock
|
||||
from mcp.types import TextContent
|
||||
|
||||
# Test if MCP is available
|
||||
try:
|
||||
import mcp
|
||||
from mcp.types import TextContent
|
||||
MCP_AVAILABLE = True
|
||||
except ImportError:
|
||||
MCP_AVAILABLE = False
|
||||
TextContent = None # Define placeholder
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user