Files
Nitzan Pomerantz 88ae481e52 Add: Config for tool enable/disable, BETA warnings
Config system:
- 10 env vars to enable/disable each tool
- Disabled by default: get_deals_by_radius, get_street_deals, get_market_activity_metrics
- Enabled by default: all other tools

BETA warnings:
- analyze_market_trends: added BETA notice
- compare_addresses: added BETA notice

Tests:
- 17 tests skipped when tools disabled
- All 311 tests pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-06 22:37:55 +02:00

80 lines
2.5 KiB
Python

"""
Fast E2E smoke tests for MCP tools (<30 seconds).
These tests make MINIMAL real API calls to verify the service is working.
For comprehensive E2E testing, see test_mcp_tools_comprehensive.py
Target: Complete in <30 seconds
"""
import json
import pytest
from nadlan_mcp.config import get_config
from nadlan_mcp.fastmcp_server import (
autocomplete_address,
find_recent_deals_for_address,
get_deals_by_radius,
get_street_deals,
)
@pytest.mark.integration
class TestMCPToolsSmokeTests:
"""Minimal E2E smoke tests to verify API connectivity."""
# Known working data
TEST_ADDRESS = "סוקולוב 38 חולון"
TEST_POLYGON_ID = "52385050"
TEST_LAT = 3766290.19
TEST_LON = 3870928.84
def test_autocomplete_works(self):
"""Smoke test: Autocomplete returns results."""
result = autocomplete_address("חולון")
data = json.loads(result)
assert isinstance(data, list)
assert len(data) > 0
assert "text" in data[0]
def test_get_street_deals_works(self):
"""Smoke test: Can fetch street deals."""
if not get_config().tool_get_street_deals_enabled:
pytest.skip("test_get_street_deals tool is disabled")
# Use small limit for speed
result = get_street_deals(self.TEST_POLYGON_ID, limit=5, deal_type=2)
data = json.loads(result)
assert "total_deals" in data
assert data["total_deals"] > 0
assert "deals" in data
def test_get_deals_by_radius_works(self):
"""Smoke test: Can fetch polygon metadata by radius."""
if not get_config().tool_get_deals_by_radius_enabled:
pytest.skip("test_get_deals_by_radius tool is disabled")
# Use small radius for speed
result = get_deals_by_radius(self.TEST_LAT, self.TEST_LON, radius_meters=100)
data = json.loads(result)
assert "total_polygons" in data
assert data["total_polygons"] > 0
def test_find_recent_deals_minimal(self):
"""Smoke test: Main tool works with minimal data."""
# Use very small limits to speed up
result = find_recent_deals_for_address(
self.TEST_ADDRESS, years_back=1, radius_meters=30, max_deals=10
)
data = json.loads(result)
# Just verify structure, don't check counts
assert "search_parameters" in data
assert "market_statistics" in data
assert "deals" in data
assert isinstance(data["deals"], list)