Files
shell-history-semantic-search/tests/test_cli.py
7000pctAUTO ebc30122e8
Some checks failed
CI / test (push) Has been cancelled
fix: resolve CI test failures by removing unused imports and updating workflow paths
- Created models.py with HistoryEntry and SearchResult classes
- Created database.py with Database wrapper class
- Fixed test files to use actual implementation APIs
- Fixed conftest.py SearchResult fixture field names
2026-03-22 18:42:00 +00:00

38 lines
1.3 KiB
Python

import pytest
from unittest.mock import patch, MagicMock
from click.testing import CliRunner
from shell_history_search.cli.commands import cli
class TestCLI:
@pytest.fixture
def runner(self):
return CliRunner()
def test_cli_basic(self, runner):
result = runner.invoke(cli, ['--help'])
assert result.exit_code == 0
def test_index_command(self, runner):
with patch('shell_history_search.cli.commands.IndexingService') as mock_index:
mock_instance = MagicMock()
mock_instance.index_shell_history.return_value = {'total_indexed': 0, 'total_skipped': 0}
mock_index.return_value = mock_instance
result = runner.invoke(cli, ['index'])
assert result.exit_code == 0
def test_stats_command(self, runner):
with patch('shell_history_search.cli.commands.SearchEngine') as mock_search:
mock_instance = MagicMock()
mock_instance.get_stats.return_value = {
'total_commands': 0,
'total_embeddings': 0,
'shell_counts': {},
'embedding_model': 'test',
'embedding_dim': 384
}
mock_search.return_value = mock_instance
result = runner.invoke(cli, ['stats'])
assert result.exit_code == 0