for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""Test kytos.core.auth module."""
import getpass
from unittest import TestCase
from unittest.mock import patch
def input_password():
"""Get password value"""
password = getpass.getpass()
return password
def input_value():
"""Get input value"""
value = input()
return value
class TestAuth(TestCase):
"""Auth tests."""
@patch("getpass.getpass")
def test_getpass(self, getpass):
"""Test when getpass is calling on authentication."""
getpass.return_value = "youshallnotpass"
assert input_password() == getpass.return_value
@patch("builtins.input")
def test_user_values(self, input):
"""Test when input is calling on authentication."""
input.return_value = "kuser"
assert input_value() == input.return_value