Add test files: conftest, test_cli, test_parsers
This commit is contained in:
89
tests/conftest.py
Normal file
89
tests/conftest.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import pytest
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def temp_project_dir(tmp_path):
|
||||||
|
pkg_json = tmp_path / "package.json"
|
||||||
|
pkg_json.write_text('''{
|
||||||
|
"name": "test-project",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.18.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"jest": "^29.0.0"
|
||||||
|
}
|
||||||
|
}''')
|
||||||
|
return tmp_path
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def ts_project_dir(tmp_path):
|
||||||
|
tsconfig = tmp_path / "tsconfig.json"
|
||||||
|
tsconfig.write_text('''{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "commonjs"
|
||||||
|
}
|
||||||
|
}''')
|
||||||
|
return tmp_path
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def python_project_dir(tmp_path):
|
||||||
|
pyproject = tmp_path / "pyproject.toml"
|
||||||
|
pyproject.write_text('''[tool.poetry]
|
||||||
|
name = "test-project"
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
testpaths = ["tests"]
|
||||||
|
''')
|
||||||
|
return tmp_path
|
||||||
|
|
||||||
|
|
||||||
|
def test_cli_import():
|
||||||
|
from config_auditor.cli import cli
|
||||||
|
assert cli is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_discovery_import():
|
||||||
|
from config_auditor.discovery import ConfigDiscovery
|
||||||
|
assert ConfigDiscovery is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_parsers_import():
|
||||||
|
from config_auditor.parsers import ParserFactory
|
||||||
|
assert ParserFactory is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_rules_import():
|
||||||
|
from config_auditor.rules import RuleRegistry
|
||||||
|
assert RuleRegistry is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_fixes_import():
|
||||||
|
from config_auditor.fixes import Fixer
|
||||||
|
assert Fixer is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_llm_import():
|
||||||
|
from config_auditor.llm import LLMProvider
|
||||||
|
assert LLMProvider is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_import():
|
||||||
|
from config_auditor.generate import ConfigGenerator
|
||||||
|
assert ConfigGenerator is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_report_import():
|
||||||
|
from config_auditor.report import ReportGenerator
|
||||||
|
assert ReportGenerator is not None
|
||||||
|
|
||||||
|
|
||||||
|
def test_utils_import():
|
||||||
|
from config_auditor.utils import find_config_file
|
||||||
|
assert find_config_file is not None
|
||||||
Reference in New Issue
Block a user