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

test_status_with_changes()   A

Complexity

Conditions 2

Size

Total Lines 49

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
c 2
b 0
f 0
dl 0
loc 49
rs 9.2258
1
import textwrap
2
3
import responses
0 ignored issues
show
Configuration introduced by
The import responses 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
from plumbum.cmd import git
0 ignored issues
show
Configuration introduced by
The import plumbum.cmd 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...
5
6
from changes.commands import status
7
8
9
def test_status(
10
    capsys,
11
    git_repo_with_merge_commit,
12
    with_auth_token_envvar
13
):
14
15
    git('tag', '0.0.2')
16
17
    status.status()
18
19
    expected_output = textwrap.dedent(
20
        """\
21
        Indexing repository...
22
        Looking for Github Auth Token in the environment...
23
        Found Github Auth Token in the environment...
24
        Repository: michaeljoseph/test_app...
25
        Latest Version...
26
        0.0.2
27
        Changes...
28
        0 changes found since 0.0.2
29
        """
30
    )
31
    out, _ = capsys.readouterr()
32
    assert expected_output == out
33
34
35
@responses.activate
36
def test_status_with_changes(
37
    capsys,
38
    git_repo_with_merge_commit,
39
    with_auth_token_envvar
40
):
41
42
    from .conftest import github_merge_commit, ISSUE_URL
43
44
    git('tag', '0.0.2')
45
    github_merge_commit(112)
46
47
    responses.add(
48
        responses.GET,
49
        ISSUE_URL.format('112'),
50
        json={
51
            'number': 112,
52
            'title': 'The title of the pull request',
53
            'body': 'An optional, longer description.',
54
            'user': {
55
                'login': 'someone'
56
            },
57
            'labels': [
58
                {'id': 1, 'name': 'bug'}
59
            ],
60
        },
61
        status=200,
62
        content_type='application/json'
63
    )
64
65
    status.status()
66
67
    expected_output = textwrap.dedent(
68
        """\
69
        Indexing repository...
70
        Looking for Github Auth Token in the environment...
71
        Found Github Auth Token in the environment...
72
        Repository: michaeljoseph/test_app...
73
        Latest Version...
74
        0.0.2
75
        Changes...
76
        1 changes found since 0.0.2
77
        #112 The title of the pull request by @someone [bug]
78
        Computed release type fix from changes issue tags...
79
        Proposed version bump 0.0.2 => 0.0.3...
80
        """
81
    )
82
    out, _ = capsys.readouterr()
83
    assert expected_output == out
84