canaille-globuzma/tests/app/commands/test_check.py

21 lines
697 B
Python

from canaille.commands import cli
def test_check_command(testclient, mock_smpp):
runner = testclient.app.test_cli_runner()
res = runner.invoke(cli, ["check"])
assert res.exit_code == 0, res.stdout
def test_check_command_fail(testclient):
testclient.app.config["CANAILLE"]["SMTP"]["HOST"] = "invalid-domain.com"
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, mock_smpp):
testclient.app.config["CANAILLE"]["SMTP"] = None
runner = testclient.app.test_cli_runner()
res = runner.invoke(cli, ["check"])
assert res.exit_code == 0, res.stdout