Skip to content

Commit 4b71da3

Browse files
committed
Fix unit testing - 232/232 pass
Signed-off-by: Mihai Criveti <[email protected]>
1 parent 3dbba45 commit 4b71da3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/unit/mcpgateway/services/test_server_service.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def mock_tool():
3838
tool = MagicMock(spec=DbTool)
3939
tool.id = 101
4040
tool.name = "test_tool"
41+
tool._sa_instance_state = MagicMock() # Mock the SQLAlchemy instance state
4142
return tool
4243

4344

@@ -46,6 +47,7 @@ def mock_resource():
4647
res = MagicMock(spec=DbResource)
4748
res.id = 201
4849
res.name = "test_resource"
50+
res._sa_instance_state = MagicMock() # Mock the SQLAlchemy instance state
4951
return res
5052

5153

@@ -54,6 +56,7 @@ def mock_prompt():
5456
pr = MagicMock(spec=DbPrompt)
5557
pr.id = 301
5658
pr.name = "test_prompt"
59+
pr._sa_instance_state = MagicMock() # Mock the SQLAlchemy instance state
5760
return pr
5861

5962

@@ -339,14 +342,17 @@ async def test_update_server(self, server_service, mock_server, test_db, mock_to
339342
new_tool = MagicMock(spec=DbTool)
340343
new_tool.id = 102
341344
new_tool.name = "new_tool"
345+
new_tool._sa_instance_state = MagicMock()
342346

343347
new_resource = MagicMock(spec=DbResource)
344348
new_resource.id = 202
345349
new_resource.name = "new_resource"
350+
new_resource._sa_instance_state = MagicMock()
346351

347352
new_prompt = MagicMock(spec=DbPrompt)
348353
new_prompt.id = 302
349354
new_prompt.name = "new_prompt"
355+
new_prompt._sa_instance_state = MagicMock()
350356

351357
test_db.get = Mock(
352358
side_effect=lambda cls, _id: (

0 commit comments

Comments
 (0)