Completed
Push — status ( 076fd7...40b3ce )
by Michael
09:58
created

test_status()   A

Complexity

Conditions 2

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

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