Files
clide/legacy/tests/unit/test_config.py
T
jpmschweitzerandClaude Opus 4.7 a355751437 move python clide to legacy/
Clide is being rebuilt as a Flutter desktop app. The Python Textual
implementation moves wholesale into legacy/ rather than being deleted:
its pane model, panel set, git skills, and panel communication design
are real thought that should remain readable next to the new code
while the rebuild finds its shape. Git's rename tracking preserves
history, so `git log -- legacy/` still works.

The Flutter rebuild lives at the repo root alongside a Go sidecar
(the architecture claudian was heading toward, which folds into
clide as a core component rather than a separate plugin project).
Bootstrap of the new shape lands in subsequent commits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 20:30:51 +02:00

76 lines
2.5 KiB
Python

"""Tests for configuration models."""
import pytest
from pydantic import ValidationError
from clide.models.config import ClideSettings, KeybindingsConfig, PanelConfig
class TestClideSettings:
"""Tests for ClideSettings model."""
def test_default_settings(self) -> None:
"""Default settings should be valid."""
settings = ClideSettings()
assert settings.theme == "summer-night"
assert settings.auto_save is True
assert settings.confirm_exit is True
assert settings.jira_enabled is False
def test_custom_settings(self) -> None:
"""Custom settings should be applied."""
settings = ClideSettings(
theme="dracula",
claude_path="/custom/path/claude",
auto_save=False,
jira_enabled=True,
)
assert settings.theme == "dracula"
assert settings.claude_path == "/custom/path/claude"
assert settings.auto_save is False
assert settings.jira_enabled is True
class TestPanelConfig:
"""Tests for PanelConfig model."""
def test_default_values(self) -> None:
"""Default values should be set correctly."""
config = PanelConfig()
assert config.sidebar_visible is True
assert config.context_visible is True
assert config.workspace_visible is False
assert config.sidebar_width_percent == 20
assert config.context_width_percent == 25
def test_frozen_model(self) -> None:
"""PanelConfig should be immutable."""
config = PanelConfig()
with pytest.raises(ValidationError):
config.sidebar_visible = False # type: ignore
def test_strict_mode(self) -> None:
"""PanelConfig should enforce strict types."""
with pytest.raises(ValidationError):
PanelConfig(sidebar_width_percent="30") # type: ignore
class TestKeybindingsConfig:
"""Tests for KeybindingsConfig model."""
def test_default_keybindings(self) -> None:
"""Default keybindings should be valid."""
config = KeybindingsConfig()
assert config.toggle_sidebar == "ctrl+b"
assert config.toggle_terminal == "ctrl+`"
assert config.focus_claude == "ctrl+1"
def test_custom_keybindings(self) -> None:
"""Custom keybindings should be applied."""
config = KeybindingsConfig(
toggle_sidebar="ctrl+shift+s",
save="cmd+s",
)
assert config.toggle_sidebar == "ctrl+shift+s"
assert config.save == "cmd+s"