testing a function which takes input from user (python) -
The function below takes the password from the user I need this test unit test / (socks).
def create_auth (): username = '{user}' Format (user = getpass.getuser ()) pwd = getpass
I am new to python, any sign will be useful thanks
Do:
Class TestCreateAuth (Unittest.TestCase): @ mock.patch ('getpass.getpass') @Mock. Patch ('getpass.getuser') def test_create_auth (auto, recipient, getpw): getuser.return_value = 'user' getpw.return_value = 'pass' self.assertEqual (create_auth (), 'user: pass')
Comments
Post a Comment