예제 #1
0
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"
예제 #2
0
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"
예제 #3
0
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"