Completed
Push — publish ( 2881fa )
by Michael
05:30
created

test_status()   B

Complexity

Conditions 2

Size

Total Lines 39

Duplication

Lines 0
Ratio 0 %

Importance

Changes 8
Bugs 0 Features 0
Metric Value
cc 2
c 8
b 0
f 0
dl 0
loc 39
rs 8.8571
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
from .conftest import github_merge_commit, ISSUE_URL, LABEL_URL
8
9
10
@responses.activate
11
def test_status(
0 ignored issues
show
Coding Style Naming introduced by
The name with_releases_directory_...bumpversion_file_prompt does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
12
    capsys,
13
    git_repo,
14
    with_auth_token_envvar,
15
    changes_config_in_tmpdir,
16
    with_releases_directory_and_bumpversion_file_prompt,
17
):
18
19
    responses.add(
20
        responses.GET,
21
        LABEL_URL,
22
        json={
23
            'bug': {
24
                "id": 208045946,
25
                "url": "https://api.github.com/repos/michaeljoseph/test_app/labels/bug",
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (88/79).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
26
                "name": "bug",
27
                "color": "f29513",
28
                "default": True
29
            },
30
        },
31
        status=200,
32
        content_type='application/json'
33
    )
34
35
    status.status()
36
37
    expected_output = textwrap.dedent(
38
        """\
39
        Found Github Auth Token in the environment...
40
        Repository: michaeljoseph/test_app...
41
        Latest Version...
42
        0.0.1
43
        Changes...
44
        0 changes found since 0.0.1
45
        """
46
    )
47
    out, _ = capsys.readouterr()
48
    assert expected_output == out
49
50
    # TODO:check project config
51
52
53
@responses.activate
54
def test_status_with_changes(
0 ignored issues
show
Coding Style Naming introduced by
The name with_releases_directory_...bumpversion_file_prompt does not conform to the argument naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
55
    capsys,
56
    git_repo,
57
    with_auth_token_envvar,
58
    changes_config_in_tmpdir,
59
    with_releases_directory_and_bumpversion_file_prompt,
60
):
61
62
    github_merge_commit(111)
63
64
    responses.add(
65
        responses.GET,
66
        ISSUE_URL.format('111'),
67
        json={
68
            'number': 111,
69
            'title': 'The title of the pull request',
70
            'body': 'An optional, longer description.',
71
            'user': {
72
                'login': 'someone'
73
            },
74
            'labels': [
75
                {'id': 1, 'name': 'bug'}
76
            ],
77
        },
78
        status=200,
79
        content_type='application/json'
80
    )
81
    responses.add(
82
        responses.GET,
83
        LABEL_URL,
84
        json={
85
            'bug': {
86
                "id": 208045946,
87
                "url": "https://api.github.com/repos/michaeljoseph/test_app/labels/bug",
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (88/79).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
88
                "name": "bug",
89
                "color": "f29513",
90
                "default": True
91
            },
92
        },
93
        status=200,
94
        content_type='application/json'
95
    )
96
97
    status.status()
98
99
    expected_output = textwrap.dedent(
100
        """\
101
        Found Github Auth Token in the environment...
102
        Repository: michaeljoseph/test_app...
103
        Latest Version...
104
        0.0.1
105
        Changes...
106
        1 changes found since 0.0.1
107
        #111 The title of the pull request by @someone [bug]
108
        Computed release type fix from changes issue tags...
109
        Proposed version bump 0.0.1 => 0.0.2...
110
        """
111
    )
112
    out, _ = capsys.readouterr()
113
    assert expected_output == out
114
115
    # TODO:check project config
116