Completed
Push — fix-ci-failures ( 4b308a...3c0b05 )
by Michael
02:37
created

test_status()   A

Complexity

Conditions 3

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 0 Features 0
Metric Value
cc 3
c 6
b 0
f 0
dl 0
loc 21
rs 9.3142
1
import textwrap
2
3
from click.testing import CliRunner
0 ignored issues
show
Configuration introduced by
The import click.testing could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4
5
import changes
6
from changes.cli import main
7
from .conftest import AUTH_TOKEN_ENVVAR
8
9
10
def test_version():
11
    runner = CliRunner()
12
    result = runner.invoke(main, ['--version'])
13
    assert result.exit_code == 0
14
    assert result.output == 'changes %s\n' % changes.__version__
15
16
17
def test_init(git_repo_with_merge_commit):
18
    result = CliRunner().invoke(
19
        main,
20
        ['init'],
21
        env={AUTH_TOKEN_ENVVAR: 'foo'},
22
    )
23
    assert result.exit_code == 0
24
25
    expected_output = textwrap.dedent(
26
        """\
27
        Indexing repository...
28
        Looking for Github Auth Token in the environment...
29
        Found Github Auth Token in the environment...
30
        """
31
    )
32
    assert expected_output == result.output
33
34
35
def test_status(git_repo):
36
    result = CliRunner().invoke(
37
       main,
38
       ['status'],
39
       env={AUTH_TOKEN_ENVVAR: 'foo'},
40
    )
41
    assert 0 == result.exit_code
42
43
    expected_output = textwrap.dedent(
44
        """\
45
        Indexing repository...
46
        Looking for Github Auth Token in the environment...
47
        Found Github Auth Token in the environment...
48
        Repository: michaeljoseph/test_app...
49
        Latest Version...
50
        0.0.0
51
        Changes...
52
        0 changes found since 0.0.0
53
        """
54
    )
55
    assert expected_output == result.output
56