Add test files (unit and integration tests)
Some checks failed
Some checks failed
This commit is contained in:
@@ -1,13 +1,8 @@
|
|||||||
"""Integration tests for LogLens."""
|
"""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.analyzers.analyzer import LogAnalyzer
|
||||||
from loglens.formatters.table_formatter import TableFormatter
|
|
||||||
from loglens.formatters.json_formatter import JSONFormatter
|
from loglens.formatters.json_formatter import JSONFormatter
|
||||||
|
from loglens.parsers.base import LogFormat
|
||||||
|
|
||||||
|
|
||||||
class TestEndToEnd:
|
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):
|
def test_apache_file_analysis(self, tmp_path):
|
||||||
"""Test complete Apache file analysis."""
|
"""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.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
|
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 = tmp_path / "apache.log"
|
||||||
log_file.write_text(log_content)
|
log_file.write_text(log_content)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user