70 lines
2.2 KiB
Python
70 lines
2.2 KiB
Python
"""
|
|
Integration tests for MCP servers.
|
|
"""
|
|
import pytest
|
|
import sys
|
|
import os
|
|
|
|
# Add the project root to the path so we can import the MCP servers
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
|
|
|
|
|
|
def test_hadolint_mcp_import():
|
|
"""Test that the Hadolint MCP server can be imported."""
|
|
try:
|
|
from mcp_servers.hadolint_mcp import server
|
|
assert server is not None
|
|
except ImportError as e:
|
|
pytest.fail(f"Failed to import Hadolint MCP server: {e}")
|
|
|
|
|
|
def test_checkov_mcp_import():
|
|
"""Test that the Checkov MCP server can be imported."""
|
|
try:
|
|
from mcp_servers.checkov_mcp import server
|
|
assert server is not None
|
|
except ImportError as e:
|
|
pytest.fail(f"Failed to import Checkov MCP server: {e}")
|
|
|
|
|
|
def test_crew_imports():
|
|
"""Test that all crew modules can be imported."""
|
|
try:
|
|
from crews.code_review_crew.code_review_crew import CodeReviewCrew
|
|
from crews.security_review_crew.security_review_crew import SecurityReviewCrew
|
|
from crews.infra_review_crew.infra_review_crew import InfraReviewCrew
|
|
from crews.summariser_crew.summariser_crew import SummariserCrew
|
|
|
|
# Test that we can instantiate the crews
|
|
code_crew = CodeReviewCrew()
|
|
security_crew = SecurityReviewCrew()
|
|
infra_crew = InfraReviewCrew()
|
|
summariser_crew = SummariserCrew()
|
|
|
|
assert code_crew is not None
|
|
assert security_crew is not None
|
|
assert infra_crew is not None
|
|
assert summariser_crew is not None
|
|
except ImportError as e:
|
|
pytest.fail(f"Failed to import crew modules: {e}")
|
|
except Exception as e:
|
|
pytest.fail(f"Failed to instantiate crews: {e}")
|
|
|
|
|
|
def test_flow_import():
|
|
"""Test that the flow module can be imported."""
|
|
try:
|
|
from src.pr_reviewer.flow import CodeReviewFlow
|
|
flow = CodeReviewFlow()
|
|
assert flow is not None
|
|
except ImportError as e:
|
|
pytest.fail(f"Failed to import flow module: {e}")
|
|
|
|
|
|
def test_main_import():
|
|
"""Test that the main module can be imported."""
|
|
try:
|
|
from src.pr_reviewer.main import app
|
|
assert app is not None
|
|
except ImportError as e:
|
|
pytest.fail(f"Failed to import main module: {e}") |