fix: check command when SMTP configuration is not defined

This commit is contained in:
Éloi Rivard 2024-05-12 10:42:41 +02:00
parent 98e5849a65
commit b16630063b
No known key found for this signature in database
GPG key ID: 7EDA204EA57DD184
2 changed files with 9 additions and 1 deletions

View file

@ -163,7 +163,8 @@ def validate(config, validate_remote=False):
from canaille.backends import Backend
Backend.instance.validate(config)
validate_smtp_configuration(config["CANAILLE"]["SMTP"])
if smtp_config := config["CANAILLE"]["SMTP"]:
validate_smtp_configuration(smtp_config)
def validate_keypair(config):

View file

@ -12,3 +12,10 @@ def test_check_command_fail(testclient):
runner = testclient.app.test_cli_runner()
res = runner.invoke(cli, ["check"])
assert res.exit_code == 1, res.stdout
def test_check_command_no_smtp(testclient):
testclient.app.config["CANAILLE"]["SMTP"] = None
runner = testclient.app.test_cli_runner()
res = runner.invoke(cli, ["check"])
assert res.exit_code == 0, res.stdout