Add test files (unit and integration tests)
Some checks failed
CI / test (3.10) (push) Failing after 4m55s
CI / test (3.11) (push) Failing after 4m58s
CI / test (3.12) (push) Failing after 4m57s
CI / test (3.9) (push) Failing after 4m49s
CI / lint (push) Failing after 4m47s
CI / build (push) Has been skipped

This commit is contained in:
2026-02-02 10:11:08 +00:00
parent ae2530577a
commit 2eccaae2af

View File

@@ -1,13 +1,8 @@
"""Integration tests for LogLens."""
import pytest
import tempfile
from pathlib import Path
from loglens.parsers.base import LogFormat
from loglens.analyzers.analyzer import LogAnalyzer
from loglens.formatters.table_formatter import TableFormatter
from loglens.formatters.json_formatter import JSONFormatter
from loglens.parsers.base import LogFormat
class TestEndToEnd:
@@ -48,10 +43,10 @@ Jan 15 10:30:02 server-01 app[1234]: WARNING: High memory usage
def test_apache_file_analysis(self, tmp_path):
"""Test complete Apache file analysis."""
log_content = '''192.168.1.1 - - [15/Jan/2024:10:30:00 +0000] "GET /api/users HTTP/1.1" 200 1234
log_content = """192.168.1.1 - - [15/Jan/2024:10:30:00 +0000] "GET /api/users HTTP/1.1" 200 1234
192.168.1.2 - - [15/Jan/2024:10:30:01 +0000] "POST /api/login HTTP/1.1" 401 567
192.168.1.3 - - [15/Jan/2024:10:30:02 +0000] "GET /api/orders HTTP/1.1" 500 4321
'''
"""
log_file = tmp_path / "apache.log"
log_file.write_text(log_content)