'Test connect failure with login error.'

@patch('ansible.modules.network.cloudvision.cv_server_provision.CvpLoginError', new_callable=(lambda : MockException))
@patch('ansible.modules.network.cloudvision.cv_server_provision.CvpClient')
def test_connect_fail(self, mock_client, mock_exception):

    module = Mock()
    module.params = dict(host='host', username='username', password='password', protocol='https', port='10')
    module.fail_json.side_effect = SystemExit
    connect_mock = Mock()
    connect_mock.connect.side_effect = mock_exception('Login    Error')
    mock_client.return_value = connect_mock
    self.assertRaises(SystemExit, cv_server_provision.connect, module)
    self.assertEqual(connect_mock.connect.call_count, 1)
    module.fail_json.assert_called_once_with(msg='Login    Error')
