Some checks failed
ci / validate (push) Has been cancelled
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a0233b-178d-7162-b92f-31a31ea8ca9b
57 lines
1.6 KiB
Python
57 lines
1.6 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from glas_harness.cli import main
|
|
from glas_harness.contract import ExecutionRequest
|
|
|
|
|
|
def test_profiles_command_lists_committed_constellations(capsys) -> None:
|
|
assert main(["profiles", "--json"]) == 0
|
|
|
|
rows = json.loads(capsys.readouterr().out)
|
|
assert {row["rein_id"] for row in rows} == {"rein-aharness", "rein-openweights"}
|
|
assert {row["operational_readiness"]["status"] for row in rows} == {
|
|
"blocked",
|
|
"unverified",
|
|
}
|
|
|
|
|
|
def test_profiles_text_output_labels_runtime_readiness(capsys) -> None:
|
|
assert main(["profiles"]) == 0
|
|
|
|
output = capsys.readouterr().out
|
|
assert "readiness=blocked" in output
|
|
assert "readiness=unverified" in output
|
|
assert "executable" not in output
|
|
|
|
|
|
def test_execution_request_example_matches_contract() -> None:
|
|
fixture = Path(__file__).resolve().parents[1] / "examples" / "execution-request.json"
|
|
|
|
request = ExecutionRequest.model_validate_json(fixture.read_text())
|
|
|
|
assert request.harness_profile_ref == "harness.agent-dev@1.0.0"
|
|
assert request.assignment_ref == "role-assignment:agent-7:42"
|
|
|
|
|
|
def test_run_command_rejects_worker_identifier_as_actor() -> None:
|
|
with pytest.raises(SystemExit) as exc_info:
|
|
main(
|
|
[
|
|
"run",
|
|
"--harness-profile",
|
|
"harness.agent-dev-local@1.0.0",
|
|
"--repo",
|
|
"/tmp/repo",
|
|
"--title",
|
|
"t",
|
|
"--description",
|
|
"d",
|
|
"--actor",
|
|
"rein-aharness@railiance01",
|
|
]
|
|
)
|
|
|
|
assert exc_info.value.code == 2
|