Skip to content

Commit fced804

Browse files
phernandezclaude
andcommitted
fix(test): update integration test for DB default project fallback (#644)
The test previously asserted that write_note fails when ConfigManager has no default_project. With the API fallback, it now correctly resolves to the database is_default project. Updated the test to verify this fallback behavior instead of expecting an error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 1fdc9fd commit fced804

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

test-int/mcp/test_default_project_mode_integration.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,32 +93,33 @@ async def test_explicit_project_overrides_default(
9393

9494

9595
@pytest.mark.asyncio
96-
async def test_no_default_project_requires_project(mcp_server, app, test_project):
97-
"""Test that tools require project parameter when no default_project is configured."""
96+
async def test_no_config_default_falls_back_to_db(mcp_server, app, test_project):
97+
"""When ConfigManager has no default_project, tools fall back to the database is_default flag."""
9898

9999
mock_config = BasicMemoryConfig(
100-
default_project=None, # No default
100+
default_project=None, # No config default
101101
projects={test_project.name: test_project.path},
102102
)
103103

104+
# test_project has is_default=True in the database, so write_note should
105+
# resolve to it via the API fallback in resolve_project_parameter.
104106
with patch.object(ConfigManager, "config", mock_config):
105107
async with Client(mcp_server) as client:
106-
with pytest.raises(Exception) as exc_info:
107-
await client.call_tool(
108-
"write_note",
109-
{
110-
"title": "Should Fail",
111-
"directory": "test",
112-
"content": "# Should Fail\n\nThis should fail because no project specified.",
113-
},
114-
)
115-
116-
error_message = str(exc_info.value)
117-
assert (
118-
"No project specified" in error_message
119-
or "project parameter" in error_message.lower()
108+
result = await client.call_tool(
109+
"write_note",
110+
{
111+
"title": "DB Fallback Test",
112+
"directory": "test",
113+
"content": "# DB Fallback Test\n\nShould resolve to the database default project.",
114+
},
120115
)
121116

117+
assert len(result.content) == 1
118+
response_text = result.content[0].text # pyright: ignore [reportAttributeAccessIssue]
119+
120+
assert f"project: {test_project.name}" in response_text
121+
assert "# Created note" in response_text
122+
122123

123124
@pytest.mark.asyncio
124125
async def test_cli_constraint_overrides_default_project(

0 commit comments

Comments
 (0)