forked from plant99/felicette
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_cli.py
29 lines (21 loc) · 722 Bytes
/
test_cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pytest
from click.testing import CliRunner
from felicette import cli
@pytest.fixture
def runner():
return CliRunner()
def test_cli(runner):
result = runner.invoke(cli.main)
assert result.exit_code == 0
assert not result.exception
assert result.output.strip() == "Hello, world."
def test_cli_with_option(runner):
result = runner.invoke(cli.main, ["--as-cowboy"])
assert not result.exception
assert result.exit_code == 0
assert result.output.strip() == "Howdy, world."
def test_cli_with_arg(runner):
result = runner.invoke(cli.main, ["Shivashis"])
assert result.exit_code == 0
assert not result.exception
assert result.output.strip() == "Hello, Shivashis."