test: replace false-green checks with behavioral coverage (#6282)
* test: replace false-green checks with behavioral coverage * test: complete behavior-focused audit coverage
This commit is contained in:
1 parent
c7ab7aa6da
commit
74942bd190
91 files changed
+1891
-1391
No files matched your search
@@ -174,9 +174,15 @@ async def test_dream_internal_run_silences_progress(tmp_path) -> None:
|
||||
store = _FakeStore(_FakeGit(initialized=False), dream_prompt_result=("dream prompt", 123))
|
||||
bus = _FakeBus()
|
||||
calls = []
|
||||
progress_sentinel = "private Dream progress sentinel"
|
||||
|
||||
async def process_direct(*args, **kwargs):
|
||||
calls.append((args, kwargs))
|
||||
await kwargs["on_progress"](progress_sentinel)
|
||||
await kwargs["on_progress"](
|
||||
"",
|
||||
tool_events=[{"phase": "start", "name": "edit_file", "hint": progress_sentinel}],
|
||||
)
|
||||
return OutboundMessage(
|
||||
channel="cli",
|
||||
chat_id="direct",
|
||||
@@ -194,11 +200,17 @@ async def test_dream_internal_run_silences_progress(tmp_path) -> None:
|
||||
)
|
||||
ctx = CommandContext(msg=msg, session=None, key=msg.session_key, raw="/dream", args="", loop=loop)
|
||||
|
||||
await _run_dream_command(ctx)
|
||||
immediate = await _run_dream_command(ctx)
|
||||
|
||||
assert immediate.content == "Dreaming..."
|
||||
assert (immediate.channel, immediate.chat_id) == ("feishu", "chat1")
|
||||
assert len(calls) == 1
|
||||
assert callable(calls[0][1]["on_progress"])
|
||||
assert calls[0][1]["runtime"] is dream_runtime
|
||||
assert len(bus.outbound) == 1
|
||||
completion = bus.outbound[0]
|
||||
assert (completion.channel, completion.chat_id) == ("feishu", "chat1")
|
||||
assert completion.content.startswith("Dream completed")
|
||||
assert progress_sentinel not in completion.content
|
||||
|
||||
|
||||
def _build_runnable_dream(
|
||||
|
||||
@@ -92,6 +92,7 @@ async def test_model_command_lists_current_and_available_presets(tmp_path) -> No
|
||||
@pytest.mark.asyncio
|
||||
async def test_model_command_switches_preset(tmp_path) -> None:
|
||||
loop = _make_loop(tmp_path)
|
||||
assert loop.tools_config.my.allow_set is False
|
||||
|
||||
out = await cmd_model(_ctx(loop, "/model fast", args="fast"))
|
||||
|
||||
@@ -172,16 +173,6 @@ async def test_model_command_reports_provider_configuration_errors(tmp_path) ->
|
||||
assert "No API key configured for provider 'openai'." in status.content
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_model_command_does_not_depend_on_my_allow_set(tmp_path) -> None:
|
||||
loop = _make_loop(tmp_path)
|
||||
assert loop.tools_config.my.allow_set is False
|
||||
|
||||
await cmd_model(_ctx(loop, "/model fast", args="fast"))
|
||||
|
||||
assert _saved_model_preset(loop) == "fast"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_model_command_registered_as_exact_and_prefix(tmp_path) -> None:
|
||||
router = CommandRouter()
|
||||
|
||||
Reference in new issue
Block a user