mirror of
https://github.com/Hopiu/djLint.git
synced 2026-03-28 19:20:24 +00:00
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
"""Djlint tests specific to .djlintrc configuration.
|
|
|
|
run::
|
|
|
|
pytest tests/test_config/test_json/test_config.py --cov=src/djlint --cov-branch \
|
|
--cov-report xml:coverage.xml --cov-report term-missing
|
|
|
|
pytest tests/test_config/test_json/test_config.py::test_custom_config
|
|
|
|
"""
|
|
# pylint: disable=C0116
|
|
|
|
from click.testing import CliRunner
|
|
|
|
from src.djlint import main as djlint
|
|
|
|
|
|
def test_config(runner: CliRunner) -> None:
|
|
result = runner.invoke(djlint, ["tests/test_config/test_json/html.html", "--check"])
|
|
|
|
assert (
|
|
"""-{% example stuff %}<p>this is a long paragraph</p>{% endexample %}
|
|
+{% example stuff %}
|
|
+ <p>this is a long paragraph</p>
|
|
+{% endexample %}
|
|
"""
|
|
in result.output
|
|
)
|
|
assert result.exit_code == 1
|
|
|
|
|
|
def test_custom_config(runner: CliRunner) -> None:
|
|
result = runner.invoke(
|
|
djlint,
|
|
[
|
|
"tests/test_config/test_json/html.html",
|
|
"--check",
|
|
"--configuration",
|
|
"tests/test_config/test_json/.djlint-cust",
|
|
],
|
|
)
|
|
assert (
|
|
"""-{% example stuff %}<p>this is a long paragraph</p>{% endexample %}
|
|
+{% example stuff %}
|
|
+ <p>this is a long paragraph</p>
|
|
+{% endexample %}
|
|
"""
|
|
in result.output
|
|
)
|
|
|
|
assert result.exit_code == 1
|