32 lines
848 B
Python
32 lines
848 B
Python
import tempfile
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from gitignore_generator.config import Config
|
|
|
|
|
|
class TestConfig:
|
|
def test_init_defaults(self):
|
|
config = Config()
|
|
assert config.custom_templates_dir.exists() or True
|
|
|
|
def test_default_output(self):
|
|
config = Config()
|
|
assert config.default_output == ".gitignore"
|
|
|
|
def test_template_dir(self):
|
|
config = Config()
|
|
assert (config.template_dir / "templates.json").exists()
|
|
|
|
def test_get_template_path(self):
|
|
config = Config()
|
|
path = config.get_template_path("python", "languages")
|
|
assert path is not None
|
|
assert path.exists()
|
|
|
|
def test_get_template_path_nonexistent(self):
|
|
config = Config()
|
|
path = config.get_template_path("nonexistent123", "languages")
|
|
assert path is None
|