mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-10-12 02:12:31 +00:00
* feat(cli): prioritize platform integrations * test(platform): update missing token assertion * chore: ignore Codex workspace files * feat(platform): expand integration catalog * feat(platform): show integration action counts * feat(platform): select agent actions separately * feat(platform): group integration applications * fix(cli): keep platform picker navigation in place * fix(cli): validate platform apps once * fix(platform): use one integration token variable * test(platform): update integration token assertion * fix(cli): clarify platform token validation * fix(cli): show platform token prompts * refactor(platform): expose application catalog * refactor(platform): export catalog from Python * docs(platform): document catalog regeneration * fix(platform): resolve catalog type export
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
import os
|
|
from io import StringIO
|
|
|
|
from crewai_cli import tui_picker
|
|
|
|
|
|
def test_visible_row_range_keeps_short_lists_fully_visible(monkeypatch) -> None:
|
|
monkeypatch.setattr(
|
|
tui_picker.shutil,
|
|
"get_terminal_size",
|
|
lambda fallback: os.terminal_size((80, 24)),
|
|
)
|
|
|
|
assert tui_picker._visible_row_range(total=8, cursor=3) == (0, 8)
|
|
|
|
|
|
def test_visible_row_range_scrolls_long_lists_around_cursor(monkeypatch) -> None:
|
|
monkeypatch.setattr(
|
|
tui_picker.shutil,
|
|
"get_terminal_size",
|
|
lambda fallback: os.terminal_size((80, 12)),
|
|
)
|
|
|
|
assert tui_picker._visible_row_range(total=125, cursor=0) == (0, 7)
|
|
assert tui_picker._visible_row_range(total=125, cursor=62) == (59, 66)
|
|
assert tui_picker._visible_row_range(total=125, cursor=124) == (118, 125)
|
|
|
|
|
|
def test_draw_multi_renders_only_the_visible_window(monkeypatch) -> None:
|
|
monkeypatch.setattr(
|
|
tui_picker.shutil,
|
|
"get_terminal_size",
|
|
lambda fallback: os.terminal_size((80, 12)),
|
|
)
|
|
output = StringIO()
|
|
monkeypatch.setattr(tui_picker.sys, "stdout", output)
|
|
|
|
line_count = tui_picker._draw_multi(
|
|
[f"Tool {index}" for index in range(125)],
|
|
cursor=62,
|
|
selected=set(),
|
|
)
|
|
|
|
rendered = output.getvalue()
|
|
assert line_count == 8
|
|
assert "showing 60-66 of 125" in rendered
|
|
assert "Tool 59" in rendered
|
|
assert "Tool 65" in rendered
|
|
assert "Tool 0" not in rendered
|
|
assert "Tool 124" not in rendered
|