Skip to content

Commit dad69bf

Browse files
committed
test(tests/test_server.py): add unit test for edit_contents_handler to check for missing patches field in request
1 parent 9a90ca6 commit dad69bf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_server.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,14 @@ async def test_main_run_error(mocker: MockerFixture):
382382
with pytest.raises(Exception) as exc_info:
383383
await main()
384384
assert "App run error" in str(exc_info.value)
385+
386+
387+
@pytest.mark.asyncio
388+
async def test_edit_contents_handler_missing_patches():
389+
"""Test EditTextFileContents handler with missing patches field."""
390+
edit_args = {"files": [{"path": "test.txt", "file_hash": "any_hash"}]}
391+
392+
result = await edit_contents_handler.run_tool(edit_args)
393+
edit_results = json.loads(result[0].text)
394+
assert edit_results["test.txt"]["result"] == "error"
395+
assert "Missing required field: patches" in edit_results["test.txt"]["reason"]

0 commit comments

Comments
 (0)