'Test availability of resource with a required extension.'

@mock.patch.object(clients.OpenStackClients, 'client_plugin')
def test_service_deployed_required_extension_exception(self, mock_client_plugin_method):

    (mock_service_types, mock_client_plugin) = self._mock_client_plugin(['test_type'])
    mock_client_plugin.has_extension = mock.Mock(side_effect=exception.AuthorizationFailure())
    mock_client_plugin_method.return_value = mock_client_plugin
    self.assertRaises(exception.AuthorizationFailure, generic_rsrc.ResourceWithDefaultClientNameExt.is_service_available, context=mock.Mock())
    mock_client_plugin_method.assert_called_once_with(generic_rsrc.ResourceWithDefaultClientName.default_client_name)
    mock_service_types.assert_called_once_with()
    mock_client_plugin.does_endpoint_exist.assert_called_once_with(service_type='test_type', service_name=generic_rsrc.ResourceWithDefaultClientName.default_client_name)
    mock_client_plugin.has_extension.assert_called_once_with('foo')
