clan-core/pkgs/clan-cli/tests/test_cli.py
DavHau 7223b25ac6
Some checks failed
build / test (push) Failing after 4s
clan-cli: fix tests
2023-07-21 14:07:38 +02:00

20 lines
559 B
Python

import sys
import clan_cli
import pytest
def test_no_args(capsys: pytest.CaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(sys, "argv", [""])
clan_cli.main()
captured = capsys.readouterr()
assert captured.out.startswith("usage:")
def test_help(capsys: pytest.CaptureFixture, monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(sys, "argv", ["", "--help"])
with pytest.raises(SystemExit):
clan_cli.main()
captured = capsys.readouterr()
assert captured.out.startswith("usage:")