mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-16 01:44:51 +03:00
Add test for leading and trailing spaces removals
This commit is contained in:
parent
69ef25a90c
commit
584da767d4
|
@ -319,10 +319,29 @@ def test_error_if_incompatible(cookies, context, invalid_context):
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_pycharm_docs_removed(cookies, context, use_pycharm, pycharm_docs_exist):
|
def test_pycharm_docs_removed(cookies, context, use_pycharm, pycharm_docs_exist):
|
||||||
"""."""
|
|
||||||
context.update({"use_pycharm": use_pycharm})
|
context.update({"use_pycharm": use_pycharm})
|
||||||
result = cookies.bake(extra_context=context)
|
result = cookies.bake(extra_context=context)
|
||||||
|
|
||||||
with open(f"{result.project_path}/docs/index.rst") as f:
|
with open(f"{result.project_path}/docs/index.rst") as f:
|
||||||
has_pycharm_docs = "pycharm/configuration" in f.read()
|
has_pycharm_docs = "pycharm/configuration" in f.read()
|
||||||
assert has_pycharm_docs is pycharm_docs_exist
|
assert has_pycharm_docs is pycharm_docs_exist
|
||||||
|
|
||||||
|
|
||||||
|
def test_trim_domain_email(cookies, context):
|
||||||
|
"""Check that leading and trailing spaces are trimmed in domain and email."""
|
||||||
|
context.update(
|
||||||
|
{
|
||||||
|
"use_docker": "y",
|
||||||
|
"domain_name": " example.com ",
|
||||||
|
"email": " me@example.com ",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
result = cookies.bake(extra_context=context)
|
||||||
|
|
||||||
|
assert result.exit_code == 0
|
||||||
|
|
||||||
|
prod_django_env = result.project_path / ".envs" / ".production" / ".django"
|
||||||
|
assert "DJANGO_ALLOWED_HOSTS=.example.com" in prod_django_env.read_text()
|
||||||
|
|
||||||
|
base_settings = result.project_path / "config" / "settings" / "base.py"
|
||||||
|
assert '"me@example.com"' in base_settings.read_text()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user