def test_ssh_open_connection_without_exception(self, mock_g): """ :return: """ ssh = mock.Mock() hostname = 'host' username = '******' password = '******' timeout = 15 actual = common.ssh_open_connection(ssh, hostname, username, password, timeout) expect = True self.assertEqual(expect, actual)
def test_ssh_open_connection_with_authentication_error(self, mock_g): """ :return: """ ssh = mock.Mock() hostname = 'host' username = '******' password = '******' timeout = 15 ssh.connect.side_effect = Exception() actual = common.ssh_open_connection(ssh, hostname, username, password, timeout) expect = False self.assertEqual(expect, actual)