2023-07-20 16:07:27 +00:00
|
|
|
import sys
|
|
|
|
|
2023-07-21 10:48:26 +00:00
|
|
|
import pytest
|
2023-07-20 16:07:27 +00:00
|
|
|
|
2023-07-21 12:01:56 +00:00
|
|
|
import clan_cli
|
|
|
|
|
2023-07-20 16:07:27 +00:00
|
|
|
|
2023-07-21 12:01:56 +00:00
|
|
|
def test_no_args(
|
|
|
|
capsys: pytest.CaptureFixture, monkeypatch: pytest.MonkeyPatch
|
|
|
|
) -> None:
|
2023-07-21 12:07:38 +00:00
|
|
|
monkeypatch.setattr(sys, "argv", [""])
|
2023-07-21 11:30:35 +00:00
|
|
|
clan_cli.main()
|
2023-07-20 16:07:27 +00:00
|
|
|
captured = capsys.readouterr()
|
|
|
|
assert captured.out.startswith("usage:")
|
|
|
|
|
|
|
|
|
2023-07-21 11:34:35 +00:00
|
|
|
def test_help(capsys: pytest.CaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
|
2023-07-21 00:01:39 +00:00
|
|
|
monkeypatch.setattr(sys, "argv", ["", "--help"])
|
|
|
|
with pytest.raises(SystemExit):
|
2023-07-21 11:30:35 +00:00
|
|
|
clan_cli.main()
|
2023-07-20 16:07:27 +00:00
|
|
|
captured = capsys.readouterr()
|
2023-07-21 00:01:39 +00:00
|
|
|
assert captured.out.startswith("usage:")
|