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

22 lines
675 B
Python
Raw Normal View History

from canaille.commands import cli
2021-11-08 17:12:51 +00:00
def test_check_command(testclient):
runner = testclient.app.test_cli_runner()
2023-04-09 13:47:14 +00:00
res = runner.invoke(cli, ["check"])
assert res.exit_code == 0, res.stdout
2021-11-08 17:12:51 +00:00
def test_check_command_fail(testclient):
testclient.app.config["CANAILLE"]["SMTP"]["HOST"] = "invalid-domain.com"
2021-11-08 17:12:51 +00:00
runner = testclient.app.test_cli_runner()
2023-04-09 13:47:14 +00:00
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