52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
"""Test configuration loading."""
|
|
|
|
from cli_memory.config import Config
|
|
|
|
|
|
def test_config_init():
|
|
"""Test Config initialization."""
|
|
config = Config()
|
|
assert config is not None
|
|
assert config._config is not None
|
|
|
|
|
|
def test_config_get():
|
|
"""Test Config.get method."""
|
|
config = Config()
|
|
|
|
assert config.get("database.path") is not None
|
|
assert config.get("recording.max_commands_per_workflow") == 100
|
|
assert config.get("nonexistent.key", "default") == "default"
|
|
|
|
|
|
def test_config_set():
|
|
"""Test Config.set method."""
|
|
config = Config()
|
|
config.set("test.value", "test_data")
|
|
assert config.get("test.value") == "test_data"
|
|
|
|
|
|
def test_config_get_home_dir():
|
|
"""Test Config.get_home_dir."""
|
|
config = Config()
|
|
home = config.get_home_dir()
|
|
assert home is not None
|
|
assert "~" not in home
|
|
|
|
|
|
def test_config_ensure_directories():
|
|
"""Test Config.ensure_directories."""
|
|
import os
|
|
config = Config()
|
|
config.ensure_directories()
|
|
home = config.get_home_dir()
|
|
assert os.path.exists(home)
|
|
|
|
|
|
def test_config_reload():
|
|
"""Test Config.reload."""
|
|
config = Config()
|
|
config.set("test.key", "value")
|
|
config.reload()
|
|
assert config.get("test.key") is None
|