tests.test_cli.runner()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nop 0
1
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned
2
3
import pytest
4
from click.testing import CliRunner
5
from expecter import expect
6
7
from slackoff.cli import clean_channel, main
8
9
10
@pytest.fixture
11
def runner():
12
    return CliRunner()
13
14
15
def describe_cli():
16
    def describe_signout():
17
        def it_can_force_signin(runner):
18
            result = runner.invoke(main, ["Foobar", "--signout"])
19
20
            expect(result.output) == "Currently signed out of Foobar\n"
21
            expect(result.exit_code) == 0
22
23
24
@pytest.mark.parametrize(
25
    ("before", "after"),
26
    [
27
        ("foobar", "foobar"),
28
        ("#foobar ", "foobar"),
29
        ("# ", None),
30
        (" ", None),
31
    ],
32
)
33
def test_clean_channel(before, after):
34
    if after is None:
35
        with expect.raises(Exception):
36
            clean_channel(None, None, before)
37
    else:
38
        expect(clean_channel(None, None, before)) == after
39