fix(backend): mock find_first in db_test for agent library tests

- Updated the test_add_agent_to_library function to mock find_first method, ensuring it returns None for better test isolation.
- Removed the include parameter from the test setup to streamline the test case.
This commit is contained in:
abhi1992002
2026-02-19 11:25:48 +05:30
parent bbfb61f867
commit bfe8dfb07c

View File

@@ -144,6 +144,7 @@ async def test_add_agent_to_library(mocker):
)
mock_library_agent = mocker.patch("prisma.models.LibraryAgent.prisma")
mock_library_agent.return_value.find_first = mocker.AsyncMock(return_value=None)
mock_library_agent.return_value.find_unique = mocker.AsyncMock(return_value=None)
mock_library_agent.return_value.create = mocker.AsyncMock(
return_value=mock_library_agent_data
@@ -178,7 +179,6 @@ async def test_add_agent_to_library(mocker):
"agentGraphVersion": 1,
}
},
include={"AgentGraph": True},
)
# Check that create was called with the expected data including settings
create_call_args = mock_library_agent.return_value.create.call_args