Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_cli_version_command_method(capsys: Any) -> None:
cli = tomodachi.cli.CLI()
with pytest.raises(SystemExit):
cli.version_command()
out, err = capsys.readouterr()
assert err == ''
assert out == 'tomodachi/{}'.format(tomodachi.__version__) + "\n"
def test_cli_entrypoint_invalid_arguments_show_help(monkeypatch: Any, capsys: Any) -> None:
cli = tomodachi.cli.CLI()
monkeypatch.setattr(logging.root, 'handlers', [])
with pytest.raises(SystemExit):
tomodachi.cli.cli_entrypoint(['tomodachi', '--invalid'])
out, err = capsys.readouterr()
assert err == ''
assert out == cli.help_command_usage() + "\n"
def test_cli_help_command_method(capsys: Any) -> None:
cli = tomodachi.cli.CLI()
with pytest.raises(SystemExit):
cli.help_command()
out, err = capsys.readouterr()
assert err == ''
assert out == cli.help_command_usage() + "\n"
def test_cli_entrypoint_invalid_subcommand_show_help(monkeypatch: Any, capsys: Any) -> None:
cli = tomodachi.cli.CLI()
monkeypatch.setattr(logging.root, 'handlers', [])
with pytest.raises(SystemExit):
tomodachi.cli.cli_entrypoint(['tomodachi', 'invalidsubcommand'])
out, err = capsys.readouterr()
assert err == ''
assert out == cli.help_command_usage() + "\n"
def test_cli_entrypoint_no_arguments(monkeypatch: Any, capsys: Any) -> None:
cli = tomodachi.cli.CLI()
monkeypatch.setattr(logging.root, 'handlers', [])
with pytest.raises(SystemExit):
tomodachi.cli.cli_entrypoint()
out, err = capsys.readouterr()
assert err == ''
assert out == cli.help_command_usage() + "\n"
def test_cli_entrypoint_print_help(monkeypatch: Any, capsys: Any) -> None:
cli = tomodachi.cli.CLI()
monkeypatch.setattr(logging.root, 'handlers', [])
with pytest.raises(SystemExit):
tomodachi.cli.cli_entrypoint(['tomodachi', '-h'])
out, err = capsys.readouterr()
assert err == ''
assert out == cli.help_command_usage() + "\n"
def test_cli_run_command_method_no_args(capsys: Any) -> None:
cli = tomodachi.cli.CLI()
with pytest.raises(SystemExit):
cli.run_command([])
out, err = capsys.readouterr()
assert err == ''
assert out == cli.run_command_usage() + "\n"