def test_check_password_password_nxos_comment(self): """ UT: nxos module:check_password method - password_line has '!' """ username = "******" password = "******" with patch("salt.modules.nxos.get_user", return_value="!", autospec=True): result = nxos_module.check_password(username, password, encrypted=False) self.assertFalse(result)
def test_check_password_return_none(self): """ UT: nxos module:check_password method - return None """ username = "******" password = "******" with patch("salt.modules.nxos.get_user", return_value=None, autospec=True): result = nxos_module.check_password(username, password, encrypted=False) self.assertIsNone(result)
def test_check_password_password_encrypted_true_negative(self): """ UT: nxos module:check_password method - password is not encrypted """ username = "******" password = "******" with patch( "salt.modules.nxos.get_user", return_value=n9k_running_config, autospec=True ): result = nxos_module.check_password(username, password, encrypted=True) self.assertFalse(result)
def test_check_password_password_encrypted_true(self): """ UT: nxos module:check_password method - password is encrypted """ username = "******" password = "******" with patch( "salt.modules.nxos.get_user", return_value=n9k_get_user_output, autospec=True, ): result = nxos_module.check_password(username, password, encrypted=True) self.assertTrue(result)
def test_check_password_password_encrypted_false(self): """ UT: nxos module:check_password method - password is not encrypted """ username = "******" password = "******" with patch( "salt.modules.nxos.get_user", return_value=n9k_get_user_output, autospec=True, ): result = nxos_module.check_password(username, password, encrypted=False) self.assertTrue(result)