feat(refactor): Document refactoring progress and phases in markdown

feat(scripts): Add backfill script for content_hash in cache tables

feat(scripts): Create recompute script for analysis_cache population

test(tests): Implement comprehensive tests for analysis module functions

fix(tests): Update CLI tests to assert errors on stderr instead of stdout

fix(tests): Adjust MCP integration tests to pass context parameter correctly

fix(tests): Modify service tests to return hash on save functions for consistency
This commit is contained in:
Ole
2026-05-29 15:16:57 +00:00
parent 5b772b2ae5
commit 55d93894ac
18 changed files with 1457 additions and 60 deletions
+5 -1
View File
@@ -7,6 +7,7 @@ import asyncio
import json
from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from mcp.server.fastmcp import Context
from finn_eiendom.mcp_server import (
finn_analyze_search,
@@ -34,6 +35,7 @@ class TestMCPToolParameterMatching:
@pytest.mark.asyncio
async def test_finn_analyze_search_parameter_passing(self):
"""Test that finn_analyze_search passes parameters correctly."""
mock_ctx = MagicMock(spec=Context)
with patch(
"finn_eiendom.mcp_server.analyze_search", new_callable=AsyncMock
) as mock_analyze:
@@ -46,6 +48,7 @@ class TestMCPToolParameterMatching:
result = await finn_analyze_search(
search_url="https://test.com",
ctx=mock_ctx,
max_pages=2,
detail_limit=10,
include_details=False,
@@ -338,10 +341,11 @@ class TestMCPToolErrorHandling:
@pytest.mark.asyncio
async def test_analyze_search_error_returns_json_error(self):
"""Test that analyze_search errors are returned as JSON error objects."""
mock_ctx = MagicMock(spec=Context)
with patch("finn_eiendom.mcp_server.analyze_search", new_callable=AsyncMock) as mock:
mock.side_effect = RuntimeError("Test error")
result = await finn_analyze_search(search_url="https://test.com")
result = await finn_analyze_search(search_url="https://test.com", ctx=mock_ctx)
# Should return JSON error object
assert isinstance(result, str)