test_click_invocation()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
"""test_read_user_variable."""
2
import click
3
4
from cookiecutter.prompt import read_user_variable
5
6
VARIABLE = 'project_name'
7
DEFAULT = 'Kivy Project'
8
9
10
def test_click_invocation(mocker):
11
    """Test click function called correctly by cookiecutter.
12
13
    Test for string type invocation.
14
    """
15
    prompt = mocker.patch('click.prompt')
16
    prompt.return_value = DEFAULT
17
18
    assert read_user_variable(VARIABLE, DEFAULT) == DEFAULT
19
20
    click.prompt.assert_called_once_with(VARIABLE, default=DEFAULT)
21