Add test files (unit and integration tests)
Some checks failed
Some checks failed
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
"""Unit tests for CLI commands."""
|
||||
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from click.testing import CliRunner
|
||||
from unittest.mock import patch, MagicMock
|
||||
import sys
|
||||
from io import StringIO
|
||||
|
||||
from loglens.cli.commands import analyze, watch, report, patterns, info
|
||||
from loglens.cli.commands import analyze, info, patterns, report, watch
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -18,7 +17,7 @@ def runner():
|
||||
class TestAnalyzeCommand:
|
||||
"""Tests for analyze command."""
|
||||
|
||||
@patch('loglens.cli.commands.LogAnalyzer')
|
||||
@patch("loglens.cli.commands.LogAnalyzer")
|
||||
def test_analyze_file(self, mock_analyzer_class, runner, tmp_path):
|
||||
"""Test analyzing a log file."""
|
||||
mock_analyzer = MagicMock()
|
||||
@@ -43,7 +42,7 @@ class TestAnalyzeCommand:
|
||||
|
||||
assert result.exit_code == 0
|
||||
|
||||
@patch('loglens.cli.commands.LogAnalyzer')
|
||||
@patch("loglens.cli.commands.LogAnalyzer")
|
||||
def test_analyze_json_output(self, mock_analyzer_class, runner, tmp_path):
|
||||
"""Test analyze with JSON output."""
|
||||
mock_analyzer = MagicMock()
|
||||
@@ -90,7 +89,7 @@ class TestWatchCommand:
|
||||
class TestReportCommand:
|
||||
"""Tests for report command."""
|
||||
|
||||
@patch('loglens.cli.commands.LogAnalyzer')
|
||||
@patch("loglens.cli.commands.LogAnalyzer")
|
||||
def test_report_to_file(self, mock_analyzer_class, runner, tmp_path):
|
||||
"""Test report generation to file."""
|
||||
mock_analyzer = MagicMock()
|
||||
@@ -118,7 +117,7 @@ class TestReportCommand:
|
||||
class TestPatternsCommand:
|
||||
"""Tests for patterns command."""
|
||||
|
||||
@patch('loglens.cli.commands.LogAnalyzer')
|
||||
@patch("loglens.cli.commands.LogAnalyzer")
|
||||
def test_list_patterns(self, mock_analyzer_class, runner):
|
||||
"""Test listing patterns."""
|
||||
mock_analyzer = MagicMock()
|
||||
|
||||
Reference in New Issue
Block a user