Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Laure Hugo <201583486+laure0303@users.noreply.github.com>
Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com>
Co-authored-by: Peter Evers <peter.evers@mistral.ai>
Co-authored-by: Jules YZERD <newtonlormont@gmail.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-06-30 15:03:21 +02:00 committed by GitHub
parent d50704e694
commit 4e495f658d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
130 changed files with 1042 additions and 552 deletions

View file

@ -4,9 +4,11 @@ from typing import Any, cast
from unittest.mock import MagicMock, patch
import pytest
from textual.content import Content
from textual.widgets import OptionList
from tests.stubs.fake_connector_registry import FakeConnectorRegistry
from vibe.cli.textual_ui.shortcut_hints import SHORTCUT_STYLE
from vibe.cli.textual_ui.widgets.connector_auth_app import (
ConnectorAuthApp,
_AuthOptionId,
@ -167,13 +169,15 @@ class TestAuthActions:
app._toggle_url()
assert app._auth_url_visible is True
text = detail.update.call_args.args[0]
assert "https://auth.example.com/oauth" in text
assert "Once authenticated" in text
assert isinstance(text, Content)
assert "https://auth.example.com/oauth" in text.plain
assert "Once authenticated" in text.plain
app._toggle_url()
assert app._auth_url_visible is False
text = detail.update.call_args.args[0]
assert "https://auth.example.com/oauth" not in text
assert isinstance(text, Content)
assert "https://auth.example.com/oauth" not in text.plain
def test_toggle_url_noop_without_url(self) -> None:
app = _make_app()
@ -193,8 +197,10 @@ class TestDetailText:
app._update_detail_text()
text = detail.update.call_args.args[0]
assert "Once authenticated, press R to refresh" in text
assert "https://auth.example.com" not in text
assert isinstance(text, Content)
assert "Once authenticated, press r to refresh" in text.plain
assert "https://auth.example.com" not in text.plain
assert any(span.style == SHORTCUT_STYLE for span in text.spans)
def test_with_url_visible(self) -> None:
app = cast(Any, _make_app())
@ -206,11 +212,13 @@ class TestDetailText:
app._update_detail_text()
text = detail.update.call_args.args[0]
assert "https://auth.example.com/oauth" in text
assert "Once authenticated, press R to refresh" in text
assert isinstance(text, Content)
assert "https://auth.example.com/oauth" in text.plain
assert "Once authenticated, press r to refresh" in text.plain
assert any(span.style == SHORTCUT_STYLE for span in text.spans)
# URL should come before the footer
url_pos = text.index("https://auth.example.com/oauth")
footer_pos = text.index("Once authenticated")
url_pos = text.plain.index("https://auth.example.com/oauth")
footer_pos = text.plain.index("Once authenticated")
assert url_pos < footer_pos