glas-harness/tests/test_cli_channel.py
tegwick 1cd890d871
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
feat: add versioned execution profiles
2026-08-21 00:21:53 +02:00

54 lines
1.5 KiB
Python

import argparse
import json
from glas_harness.channels.base import Channel, GatewayInvocation
from glas_harness.channels.cli_channel import CLIChannel
def test_cli_channel_is_a_channel() -> None:
assert issubclass(CLIChannel, Channel)
def _args(**overrides) -> argparse.Namespace:
defaults = dict(
harness_profile="harness.agent-dev-local@1.0.0",
repo="/tmp/repo",
title="t",
description="d",
actor="agt",
project="glas-harness",
no_hub=False,
)
defaults.update(overrides)
return argparse.Namespace(**defaults)
def test_parse_invocation_maps_all_fields() -> None:
channel = CLIChannel()
invocation = channel.parse_invocation(_args())
assert invocation == GatewayInvocation(
harness_profile="harness.agent-dev-local@1.0.0",
repo="/tmp/repo",
title="t",
description="d",
actor="agt",
project="glas-harness",
report_to_hub=True,
)
def test_parse_invocation_inverts_no_hub_flag() -> None:
channel = CLIChannel()
invocation = channel.parse_invocation(_args(no_hub=True))
assert invocation.report_to_hub is False
def test_render_result_matches_pre_refactor_output() -> None:
channel = CLIChannel()
result = {"sandbox_id": "sbx1", "tool_ok": True, "summary": {"committed": "True"}}
rendered = channel.render_result(result)
assert rendered == json.dumps(result, indent=2)
assert json.loads(rendered) == result