27 lines
838 B
Python
27 lines
838 B
Python
|
|
"""Tests for the configuration model."""
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
from pydantic import ValidationError
|
||
|
|
|
||
|
|
from vibe_coded_mcp_desktop_control.config import DesktopControlConfig
|
||
|
|
|
||
|
|
|
||
|
|
def test_default_config() -> None:
|
||
|
|
"""A default config should have no delay and no layout override."""
|
||
|
|
cfg = DesktopControlConfig()
|
||
|
|
assert cfg.pre_action_delay_ms == 0
|
||
|
|
assert cfg.keyboard_layout is None
|
||
|
|
|
||
|
|
|
||
|
|
def test_custom_config() -> None:
|
||
|
|
"""Config values should be accepted and stored."""
|
||
|
|
cfg = DesktopControlConfig(pre_action_delay_ms=100, keyboard_layout="si")
|
||
|
|
assert cfg.pre_action_delay_ms == 100
|
||
|
|
assert cfg.keyboard_layout == "si"
|
||
|
|
|
||
|
|
|
||
|
|
def test_negative_delay_rejected() -> None:
|
||
|
|
"""A negative pre-action delay should fail validation."""
|
||
|
|
with pytest.raises(ValidationError):
|
||
|
|
DesktopControlConfig(pre_action_delay_ms=-1)
|