From 9e666c445e9c060f8041230d5e2e166f93b4a33a Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Fri, 30 Jan 2026 05:31:02 +0000 Subject: [PATCH] Add exporters, utils, and tests --- .tests/test_config.py | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .tests/test_config.py diff --git a/.tests/test_config.py b/.tests/test_config.py new file mode 100644 index 0000000..cbbd23f --- /dev/null +++ b/.tests/test_config.py @@ -0,0 +1,45 @@ +"""Tests for configuration.""" + +import os +from pathlib import Path +import pytest + +from termflow.config import Config +from termflow.utils.config import load_config, get_default_db_path + + +class TestConfig: + """Test configuration management.""" + + def test_config_dir_creation(self, tmp_path, monkeypatch): + """Test config directory creation.""" + monkeypatch.setenv("TERMFLOW_HOME", str(tmp_path / ".termflow")) + config = Config() + assert config.config_dir.exists() + + def test_default_db_path(self, tmp_path, monkeypatch): + """Test default database path.""" + monkeypatch.setenv("TERMFLOW_HOME", str(tmp_path / ".termflow")) + config = Config() + assert "sessions.db" in config.db_path + + def test_git_cache_path(self, tmp_path, monkeypatch): + """Test git cache path.""" + monkeypatch.setenv("TERMFLOW_HOME", str(tmp_path / ".termflow")) + config = Config() + assert "git_cache" in config.git_cache + + +class TestConfigUtils: + """Test configuration utilities.""" + + def test_load_config_missing(self, tmp_path): + """Test loading missing config.""" + result = load_config(str(tmp_path / "missing")) + assert result == {} + + def test_get_default_db_path(self): + """Test default db path generation.""" + path = get_default_db_path() + assert "sessions.db" in path + assert ".termflow" in path