diff --git a/canaille/app/configuration.py b/canaille/app/configuration.py index a5072799..bddee471 100644 --- a/canaille/app/configuration.py +++ b/canaille/app/configuration.py @@ -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): diff --git a/tests/app/commands/test_check.py b/tests/app/commands/test_check.py index 05d79873..5163580f 100644 --- a/tests/app/commands/test_check.py +++ b/tests/app/commands/test_check.py @@ -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