stages/email: add test for non-existent directory
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
2ea7bd86e8
commit
ac6afb2b82
|
@ -37,7 +37,7 @@ def get_template_choices():
|
||||||
|
|
||||||
dirs = [Path(x) for x in settings.TEMPLATES[0]["DIRS"]]
|
dirs = [Path(x) for x in settings.TEMPLATES[0]["DIRS"]]
|
||||||
for template_dir in dirs:
|
for template_dir in dirs:
|
||||||
if not template_dir.exists():
|
if not template_dir.exists() or not template_dir.is_dir():
|
||||||
continue
|
continue
|
||||||
for template in template_dir.glob("**/*.html"):
|
for template in template_dir.glob("**/*.html"):
|
||||||
path = str(template)
|
path = str(template)
|
||||||
|
|
|
@ -13,7 +13,7 @@ from authentik.stages.email.models import get_template_choices
|
||||||
def get_templates_setting(temp_dir: str) -> dict[str, Any]:
|
def get_templates_setting(temp_dir: str) -> dict[str, Any]:
|
||||||
"""Patch settings TEMPLATE's dir property"""
|
"""Patch settings TEMPLATE's dir property"""
|
||||||
templates_setting = settings.TEMPLATES
|
templates_setting = settings.TEMPLATES
|
||||||
templates_setting[0]["DIRS"] = [temp_dir]
|
templates_setting[0]["DIRS"] = [temp_dir, "foo"]
|
||||||
return templates_setting
|
return templates_setting
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue