- L_TestFlight: empty, zero-gravity level for Phase 0 flight testing, set as editor/game default map. - Enable UnrealMCPython + Python Editor Script Plugin, third-party MCP plugin (GenOrca/unreal-mcp v2.2.0) giving direct editor control (actors, blueprints, levels, materials, etc.) alongside Epic's built-in Unreal MCP plugin. - Vendor the mcp-server Python source used to bridge to the plugin. - .mcp.json intentionally gitignored (machine-specific absolute paths).
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
# Copyright (c) 2025 GenOrca. All Rights Reserved.
|
|
|
|
"""Unit tests for the TCP response unwrapping (offline, no Unreal)."""
|
|
|
|
from unreal_mcp.core import _unwrap_result
|
|
|
|
|
|
def test_unwraps_action_dict_from_result_string():
|
|
wire = {
|
|
"success": True, # python-exec success, NOT action success
|
|
"message": "Python command executed successfully.",
|
|
"result": '{"success": true, "actor_label": "PointLight_2"}',
|
|
}
|
|
out = _unwrap_result(wire)
|
|
assert out == {"success": True, "actor_label": "PointLight_2"}
|
|
|
|
|
|
def test_unwrapped_inner_failure_is_surfaced():
|
|
"""Action failure (inner success=False) must survive unwrapping as data."""
|
|
wire = {
|
|
"success": True, # python ran fine...
|
|
"result": '{"success": false, "message": "Actor not found"}',
|
|
}
|
|
out = _unwrap_result(wire)
|
|
assert out["success"] is False
|
|
assert out["message"] == "Actor not found"
|
|
|
|
|
|
def test_unwraps_list_result():
|
|
wire = {"success": True, "result": '[1, 2, 3]'}
|
|
assert _unwrap_result(wire) == [1, 2, 3]
|
|
|
|
|
|
def test_non_json_result_returns_original():
|
|
wire = {"success": True, "result": "not json at all"}
|
|
assert _unwrap_result(wire) == wire
|
|
|
|
|
|
def test_missing_result_returns_original():
|
|
wire = {"success": True, "message": "ok"}
|
|
assert _unwrap_result(wire) == wire
|
|
|
|
|
|
def test_non_dict_passthrough():
|
|
assert _unwrap_result("raw") == "raw"
|