Completed
Push — pyup-update-toml-0.9.2-to-0.9.... ( 3e288d )
by Michael
21:07 queued 21:02
created

test_status_with_changes()   B

Complexity

Conditions 2

Size

Total Lines 41

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 41
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
5
from changes.commands import status
6
from .conftest import github_merge_commit, ISSUE_URL, LABEL_URL, BUG_LABEL_JSON, PULL_REQUEST_JSON
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (98/79).

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

Loading history...
7
8
9
@responses.activate
10
def test_status(
11
    capsys,
12
    git_repo,
13
    configured,
14
):
15
16
    responses.add(
17
        responses.GET,
18
        LABEL_URL,
19
        json=BUG_LABEL_JSON,
20
        status=200,
21
        content_type='application/json'
22
    )
23
24
    status.status()
25
26
    expected_output = textwrap.dedent(
27
        """\
28
        Status [michaeljoseph/test_app]...
29
        Repository: michaeljoseph/test_app...
30
        Latest Version...
31
        0.0.1
32
        Changes...
33
        0 changes found since 0.0.1
34
        """
35
    )
36
    out, _ = capsys.readouterr()
37
    assert expected_output == out
38
39
    # TODO:check project config
40
41
42
@responses.activate
43
def test_status_with_changes(
44
    capsys,
45
    git_repo,
46
    configured,
47
):
48
49
    responses.add(
50
        responses.GET,
51
        LABEL_URL,
52
        json=BUG_LABEL_JSON,
53
        status=200,
54
        content_type='application/json'
55
    )
56
57
    github_merge_commit(111)
58
    responses.add(
59
        responses.GET,
60
        ISSUE_URL.format('111'),
61
        json=PULL_REQUEST_JSON,
62
        status=200,
63
        content_type='application/json'
64
    )
65
66
    status.status()
67
68
    expected_output = textwrap.dedent(
69
        """\
70
        Status [michaeljoseph/test_app]...
71
        Repository: michaeljoseph/test_app...
72
        Latest Version...
73
        0.0.1
74
        Changes...
75
        1 changes found since 0.0.1
76
        #111 The title of the pull request by @someone [bug]
77
        Computed release type fix from changes issue tags...
78
        Proposed version bump 0.0.1 => 0.0.2...
79
        """
80
    )
81
    out, _ = capsys.readouterr()
82
    assert expected_output == out
83