Test Failed
Pull Request — master (#966)
by Gleyberson
02:36
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
def input_password():
7
    """Get password value"""
8
    password = getpass.getpass()
9
    return password
10
11
12
def input_value():
13
    """Get input value"""
14
    value = input()
15
    return value
16
17
18
class TestAuth(TestCase):
19
    """Auth tests."""
20
21
    @patch("getpass.getpass")
22
    def test_getpass(self, getpass):
23
        """Test when getpass is calling on authentication."""
24
        getpass.return_value = "youshallnotpass"
25
        assert input_password() == getpass.return_value
26
27
    @patch("builtins.input")
28
    def test_user_values(self, input):
29
        """Test when input is calling on authentication."""
30
        input.return_value = "kuser"
31
        assert input_value() == input.return_value
32