Passed
Pull Request — master (#966)
by Gleyberson
02:37
created

TestAuth.test_user_values()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
"""Test kytos.core.auth module."""
2
import getpass
3
from unittest import TestCase
4
from unittest.mock import patch
5
6
7
def input_password():
8
    """Get password value"""
9
    password = getpass.getpass()
10
    return password
11
12
13
def input_value():
14
    """Get input value"""
15
    value = input()
16
    return value
17
18
19
class TestAuth(TestCase):
20
    """Auth tests."""
21
22
    @classmethod
23
    @patch("getpass.getpass")
24
    def test_getpass(cls, password):
25
        """Test when getpass is calling on authentication."""
26
        password.return_value = "youshallnotpass"
27
        assert input_password() == password.return_value
28
29
    @classmethod
30
    @patch("builtins.input")
31
    def test_user_values(cls, user_value):
32
        """Test when input is calling on authentication."""
33
        user_value.return_value = "kuser"
34
        assert input_value() == user_value.return_value
35