Some checks failed
CI / test (push) Has been cancelled
- Removed unused imports from test files (os, pytest, pathlib.Path, MagicMock, patch, numpy, sqlite3, IndexingService) - Updated CI workflow to only check shell-history-semantic-search project files instead of all files in shared src/ and tests/ directories - All 43 tests pass locally
32 lines
973 B
Python
32 lines
973 B
Python
import pytest
|
|
from unittest.mock import patch, MagicMock
|
|
|
|
from click.testing import CliRunner
|
|
from shell_history_search.cli import cli
|
|
|
|
|
|
class TestCLI:
|
|
@pytest.fixture
|
|
def runner(self):
|
|
return CliRunner()
|
|
|
|
@pytest.fixture
|
|
def mock_search(self):
|
|
with patch('shell_history_search.cli.search_shell_history') as mock:
|
|
yield mock
|
|
|
|
def test_cli_basic(self, runner, mock_search):
|
|
mock_search.return_value = []
|
|
result = runner.invoke(cli, ['--query', 'test'])
|
|
assert result.exit_code == 0
|
|
|
|
def test_cli_with_limit(self, runner, mock_search):
|
|
mock_search.return_value = []
|
|
result = runner.invoke(cli, ['--query', 'test', '--limit', '5'])
|
|
assert result.exit_code == 0
|
|
|
|
def test_cli_with_shell_filter(self, runner, mock_search):
|
|
mock_search.return_value = []
|
|
result = runner.invoke(cli, ['--query', 'test', '--shell', 'bash'])
|
|
assert result.exit_code == 0
|