import pytest from .test_helpers import DummyContext @pytest.mark.asyncio async def test_run_tests_async_forwards_params(monkeypatch): from services.tools.run_tests import run_tests captured = {} async def fake_send_with_unity_instance(send_fn, unity_instance, command_type, params, **kwargs): captured["command_type"] = command_type captured["params"] = params return {"success": True, "data": {"job_id": "abc123", "status": "running", "mode": "EditMode"}} import services.tools.run_tests as mod monkeypatch.setattr( mod.unity_transport, "send_with_unity_instance", fake_send_with_unity_instance) resp = await run_tests( DummyContext(), mode="EditMode", test_names="MyNamespace.MyTests.TestA", include_details=True, ) assert captured["command_type"] == "run_tests" assert captured["params"]["mode"] == "EditMode" assert captured["params"]["testNames"] == ["MyNamespace.MyTests.TestA"] assert captured["params"]["includeDetails"] is True assert resp.success is True assert resp.data is not None assert resp.data.job_id == "abc123" @pytest.mark.asyncio async def test_get_test_job_forwards_job_id(monkeypatch): from services.tools.run_tests import get_test_job captured = {} async def fake_send_with_unity_instance(send_fn, unity_instance, command_type, params, **kwargs): captured["command_type"] = command_type captured["params"] = params return {"success": True, "data": {"job_id": params["job_id"], "status": "running", "mode": "EditMode"}} import services.tools.run_tests as mod monkeypatch.setattr( mod.unity_transport, "send_with_unity_instance", fake_send_with_unity_instance) resp = await get_test_job(DummyContext(), job_id="job-1") assert captured["command_type"] == "get_test_job" assert captured["params"]["job_id"] == "job-1" assert resp.success is True assert resp.data is not None assert resp.data.job_id == "job-1"