# Path: oslo_vmware/vim_util.py
# LOG = logging.getLogger(__name__)
# def get_moref(value, type_):
# def get_moref_value(moref):
# def get_moref_type(moref):
# def build_selection_spec(client_factory, name):
# def build_traversal_spec(client_factory, name, type_, path, skip, select_set):
# def build_recursive_traversal_spec(client_factory):
# def build_property_spec(client_factory, type_='VirtualMachine',
#                         properties_to_collect=None, all_properties=False):
# def build_object_spec(client_factory, root_folder, traversal_specs):
# def build_property_filter_spec(client_factory, property_specs, object_specs):
# def get_objects(vim, type_, max_objects, properties_to_collect=None,
#                 all_properties=False):
# def get_object_properties(vim, moref, properties_to_collect, skip_op_id=False):
# def get_object_properties_dict(vim, moref, properties_to_collect):
# def _get_token(retrieve_result):
# def cancel_retrieval(vim, retrieve_result):
# def continue_retrieval(vim, retrieve_result):
#     def __init__(self, vim, retrieve_result):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_value, traceback):
#     def __iter__(self):
# def get_object_property(vim, moref, property_name, skip_op_id=False):
# def find_extension(vim, key):
# def register_extension(vim, key, type, label='OpenStack',
#                        summary='OpenStack services', version='1.0'):
# def get_vc_version(session):
# def get_inventory_path(vim, entity_ref, max_objects=100):
# def get_http_service_request_spec(client_factory, method, uri):
# def get_prop_spec(client_factory, spec_type, properties):
# def get_obj_spec(client_factory, obj, select_set=None):
# def get_prop_filter_spec(client_factory, obj_spec, prop_spec):
# def get_properties_for_a_collection_of_objects(vim, type_,
#                                                obj_list, properties,
#                                                max_objects=None):
# def propset_dict(propset):
# def storage_placement_spec(client_factory,
#                            dsc_ref,
#                            type,
#                            clone_spec=None,
#                            config_spec=None,
#                            relocate_spec=None,
#                            vm_ref=None,
#                            folder=None,
#                            clone_name=None,
#                            res_pool_ref=None,
#                            host_ref=None):
# def serialize_object(obj):
# class WithRetrieval(object):


import collections
from unittest import mock
from oslo_vmware.tests import base
from oslo_vmware import vim_util
            pass

        cancel_retrieval.assert_called_once_with(vim, retrieve_result)

    @mock.patch('oslo_vmware.vim_util.get_object_properties')
    def test_get_object_property(self, get_object_properties):
        prop = mock.Mock()
        prop.val = "ubuntu-12.04"
        properties = mock.Mock()
        properties.propSet = [prop]
        properties_list = [properties]
        get_object_properties.return_value = properties_list
        vim = mock.Mock()
        moref = mock.Mock()
        property_name = 'name'
        val = vim_util.get_object_property(vim, moref, property_name)
        self.assertEqual(prop.val, val)
        get_object_properties.assert_called_once_with(
            vim, moref, [property_name], skip_op_id=False)

    def test_find_extension(self):
        vim = mock.Mock()
        ret = vim_util.find_extension(vim, 'fake-key')
        self.assertIsNotNone(ret)
        service_content = vim.service_content
        vim.FindExtension.assert_called_once_with(
            service_content.extensionManager, extensionKey='fake-key')

    def test_register_extension(self):
        vim = mock.Mock()

# Path: oslo_vmware/vim_util.py
# LOG = logging.getLogger(__name__)
# def get_moref(value, type_):
# def get_moref_value(moref):
# def get_moref_type(moref):
# def build_selection_spec(client_factory, name):
# def build_traversal_spec(client_factory, name, type_, path, skip, select_set):
# def build_recursive_traversal_spec(client_factory):
# def build_property_spec(client_factory, type_='VirtualMachine',
#                         properties_to_collect=None, all_properties=False):
# def build_object_spec(client_factory, root_folder, traversal_specs):
# def build_property_filter_spec(client_factory, property_specs, object_specs):
# def get_objects(vim, type_, max_objects, properties_to_collect=None,
#                 all_properties=False):
# def get_object_properties(vim, moref, properties_to_collect, skip_op_id=False):
# def get_object_properties_dict(vim, moref, properties_to_collect):
# def _get_token(retrieve_result):
# def cancel_retrieval(vim, retrieve_result):
# def continue_retrieval(vim, retrieve_result):
#     def __init__(self, vim, retrieve_result):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_value, traceback):
#     def __iter__(self):
# def get_object_property(vim, moref, property_name, skip_op_id=False):
# def find_extension(vim, key):
# def register_extension(vim, key, type, label='OpenStack',
#                        summary='OpenStack services', version='1.0'):
# def get_vc_version(session):
# def get_inventory_path(vim, entity_ref, max_objects=100):
# def get_http_service_request_spec(client_factory, method, uri):
# def get_prop_spec(client_factory, spec_type, properties):
# def get_obj_spec(client_factory, obj, select_set=None):
# def get_prop_filter_spec(client_factory, obj_spec, prop_spec):
# def get_properties_for_a_collection_of_objects(vim, type_,
#                                                obj_list, properties,
#                                                max_objects=None):
# def propset_dict(propset):
# def storage_placement_spec(client_factory,
#                            dsc_ref,
#                            type,
#                            clone_spec=None,
#                            config_spec=None,
#                            relocate_spec=None,
#                            vm_ref=None,
#                            folder=None,
#                            clone_name=None,
#                            res_pool_ref=None,
#                            host_ref=None):
# def serialize_object(obj):
# class WithRetrieval(object):


# Path: oslo_vmware/tests/test_vim_util.py
import collections
from unittest import mock
from oslo_vmware.tests import base
from oslo_vmware import vim_util

            pass

        cancel_retrieval.assert_called_once_with(vim, retrieve_result)

    @mock.patch('oslo_vmware.vim_util.get_object_properties')
    def test_get_object_property(self, get_object_properties):
        prop = mock.Mock()
        prop.val = "ubuntu-12.04"
        properties = mock.Mock()
        properties.propSet = [prop]
        properties_list = [properties]
        get_object_properties.return_value = properties_list
        vim = mock.Mock()
        moref = mock.Mock()
        property_name = 'name'
        val = vim_util.get_object_property(vim, moref, property_name)
        self.assertEqual(prop.val, val)
        get_object_properties.assert_called_once_with(
            vim, moref, [property_name], skip_op_id=False)

    def test_find_extension(self):
        vim = mock.Mock()
        ret = vim_util.find_extension(vim, 'fake-key')
        self.assertIsNotNone(ret)
        service_content = vim.service_content
        vim.FindExtension.assert_called_once_with(
            service_content.extensionManager, extensionKey='fake-key')

    def test_register_extension(self):
        vim = mock.Mock()

        ret = vim_util.register_extension(vim, 'fake-key', 'fake-type')