Completed
Push — status ( c6e980...e9a265 )
by Michael
09:09
created

test_init_finds_auth_token_in_environment()   A

Complexity

Conditions 2

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
c 0
b 0
f 0
dl 0
loc 19
rs 9.4285
1
import os
2
import textwrap
3
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 init
7
from .conftest import AUTH_TOKEN_ENVVAR
8
9
10
def test_init_prompts_for_auth_token_and_writes_dot_env(
0 ignored issues
show
Coding Style Naming introduced by
The name test_init_prompts_for_au...oken_and_writes_dot_env does not conform to the function 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...
11
    capsys,
12
    git_repo_with_merge_commit,
13
    with_auth_token_prompt
14
):
15
    git('tag', '0.0.2')
16
    git('tag', '0.0.3')
17
18
    init.init()
19
20
    expected_output = textwrap.dedent(
21
        """\
22
        Indexing repository...
23
        Looking for Github Auth Token in the environment...
24
        No auth token found, asking for it...
25
        You need a Github Auth Token for changes to create a release.
26
        Appending GITHUB_AUTH_TOKEN setting to .env file
27
        """
28
    )
29
    out, _ = capsys.readouterr()
30
    assert expected_output == out
31
32
    assert os.path.exists('.env')
33
    assert '{}=foo'.format(AUTH_TOKEN_ENVVAR) == open('.env').read()
34
35
36
def test_init_finds_auth_token_in_environment(
0 ignored issues
show
Coding Style Naming introduced by
The name test_init_finds_auth_token_in_environment does not conform to the function 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...
37
    capsys,
38
    git_repo_with_merge_commit,
39
    with_auth_token_envvar
40
):
41
    git('tag', '0.0.2')
42
    git('tag', '0.0.3')
43
44
    init.init()
45
46
    expected_output = textwrap.dedent(
47
        """\
48
        Indexing repository...
49
        Looking for Github Auth Token in the environment...
50
        Found Github Auth Token in the environment...
51
        """
52
    )
53
    out, _ = capsys.readouterr()
54
    assert expected_output == out
55