Skip to content

Commit 62332d5

Browse files
committed
Fix HTTP transport tests to expect raw data format instead of TextResource wrapper
1 parent 6380d51 commit 62332d5

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

servers/mcp-neo4j-memory/tests/integration/test_http_transport.py

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ async def http_server(self, neo4j_container):
118118
process = await asyncio.create_subprocess_exec(
119119
"uv", "run", "mcp-neo4j-memory",
120120
"--transport", "http",
121-
"--host", "127.0.0.1",
122-
"--port", "8004",
121+
"--server-host", "127.0.0.1",
122+
"--server-port", "8004",
123123
"--db-url", neo4j_container.get_connection_url(),
124124
"--username", neo4j_container.username,
125125
"--password", neo4j_container.password,
@@ -203,18 +203,13 @@ async def test_http_read_graph(self, http_server):
203203
assert response.status == 200
204204
assert "result" in result
205205
assert "content" in result["result"]
206-
# Parse the TextResource content
206+
# Parse the content
207207
content = result["result"]["content"]
208208
assert len(content) > 0
209-
# FastMCP wraps the response in a text field
210-
assert "text" in content[0]
211-
# The text field contains a TextResource object, parse it
212-
import json
213-
text_resource = json.loads(content[0]["text"])
214-
assert "text" in text_resource
215-
# Parse the actual data from the TextResource
216-
actual_data = json.loads(text_resource["text"])
209+
# The content contains the actual data directly
210+
actual_data = content[0]
217211
assert "entities" in actual_data
212+
assert "relations" in actual_data
218213

219214
@pytest.mark.asyncio
220215
async def test_http_create_entities(self, http_server):
@@ -246,19 +241,15 @@ async def test_http_create_entities(self, http_server):
246241
assert response.status == 200
247242
assert "result" in result
248243
assert "content" in result["result"]
249-
# Parse the TextResource content
244+
# Parse the content
250245
content = result["result"]["content"]
251246
assert len(content) > 0
252-
# FastMCP wraps the response in a text field
253-
assert "text" in content[0]
254-
# The text field contains a TextResource object, parse it
255-
import json
256-
text_resource = json.loads(content[0]["text"])
257-
assert "text" in text_resource
258-
# Parse the actual data from the TextResource
259-
actual_data = json.loads(text_resource["text"])
260-
assert isinstance(actual_data, list)
261-
assert len(actual_data) > 0
247+
# The content contains the actual data directly
248+
actual_data = content[0]
249+
assert isinstance(actual_data, dict)
250+
assert "name" in actual_data
251+
assert "type" in actual_data
252+
assert "observations" in actual_data
262253

263254
@pytest.mark.asyncio
264255
async def test_http_search_nodes(self, http_server):
@@ -284,14 +275,14 @@ async def test_http_search_nodes(self, http_server):
284275
assert response.status == 200
285276
assert "result" in result
286277
assert "content" in result["result"]
287-
# Parse the TextResource content
278+
# Parse the content
288279
content = result["result"]["content"]
289280
assert len(content) > 0
290-
# FastMCP wraps the response in a text field
291-
assert "text" in content[0]
281+
# The content contains the actual data directly
282+
actual_data = content[0]
292283
# For now, just verify we get a response (the search tool has a parameter conflict)
293284
# TODO: Fix the search_nodes tool parameter conflict
294-
assert "text" in content[0]
285+
assert isinstance(actual_data, dict)
295286

296287

297288
class TestErrorHandling:
@@ -309,7 +300,7 @@ async def http_server(self, neo4j_container):
309300
})
310301

311302
process = await asyncio.create_subprocess_exec(
312-
"uv", "run", "mcp-neo4j-memory", "--transport", "http", "--host", "127.0.0.1", "--port", "8005",
303+
"uv", "run", "mcp-neo4j-memory", "--transport", "http", "--server-host", "127.0.0.1", "--server-port", "8005",
313304
"--db-url", neo4j_container.get_connection_url(),
314305
"--username", neo4j_container.username,
315306
"--password", neo4j_container.password,
@@ -423,7 +414,7 @@ async def test_full_workflow(self, neo4j_container):
423414
})
424415

425416
process = await asyncio.create_subprocess_exec(
426-
"uv", "run", "mcp-neo4j-memory", "--transport", "http", "--host", "127.0.0.1", "--port", "8006",
417+
"uv", "run", "mcp-neo4j-memory", "--transport", "http", "--server-host", "127.0.0.1", "--server-port", "8006",
427418
"--db-url", neo4j_container.get_connection_url(),
428419
"--username", neo4j_container.username,
429420
"--password", neo4j_container.password,

0 commit comments

Comments
 (0)