pass-gen/app/main_test.py
2021-07-05 19:20:57 +02:00

22 lines
463 B
Python

from typer.testing import CliRunner, Result
from .main import app
runner = CliRunner()
def test_cli_print_password() -> None:
result = _run_cli()
assert "2yW4AcqG" in result.stdout
def test_cli_can_set_password_length() -> None:
args = ["--length", 10]
result = _run_cli(*args)
assert "2yW4AcqGFz" in result.stdout
def _run_cli(*args) -> Result:
result = runner.invoke(app, args)
assert result.exit_code == 0
return result