| Total Complexity | 5 | 
| Total Lines | 39 | 
| Duplicated Lines | 0 % | 
| Changes | 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 |