Test Failed
Pull Request — master (#966)
by Gleyberson
03:55
created

tests.test_core.test_auth.TestAuth.test_getpass()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 2
dl 0
loc 5
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
    @patch("getpass.getpass")
23
    def test_getpass(self, getpass):
24
        """Test when getpass is calling on authentication."""
25
        getpass.return_value = "youshallnotpass"
26
        assert input_password() == getpass.return_value
27
28
    @patch("builtins.input")
29
    def test_user_values(self, input):
30
        """Test when input is calling on authentication."""
31
        input.return_value = "kuser"
32
        assert input_value() == input.return_value
33