-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_cli.py
60 lines (46 loc) · 1.38 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# noqa: D100
import pytest
from click.testing import CliRunner
import birdy.cli.run
from .common import EMU_CAPS_XML, URL_EMU
cli = birdy.cli.run.cli
cli.url = URL_EMU
cli.caps_xml = EMU_CAPS_XML
@pytest.mark.online
def test_help(): # noqa: D103
runner = CliRunner()
result = runner.invoke(cli, ["--help"])
assert result.exit_code == 0
assert "hello" in result.output
assert "wordcount" in result.output
assert "language" in result.output
assert "show-languages" in result.output
@pytest.mark.online
def test_show_languages(): # noqa: D103
runner = CliRunner()
result = runner.invoke(cli, ["--show-languages"])
assert result.exit_code == 0
assert "en-US" in result.output
@pytest.mark.online
def test_hello(): # noqa: D103
runner = CliRunner()
result = runner.invoke(cli, ["hello", "--help"])
assert result.exit_code == 0
assert "--name" in result.output
@pytest.mark.online
def test_hello_stranger(): # noqa: D103
runner = CliRunner()
result = runner.invoke(cli, ["hello", "--name", "stranger"])
assert result.exit_code == 0
@pytest.mark.online
@pytest.mark.xfail(reason="click hides exception")
def test_multiple_outputs(): # noqa: D103
runner = CliRunner()
result = runner.invoke(
cli,
[
"multiple_outputs",
"--count 2",
],
)
assert result.exit_code == 0