# Path: oslo_vmware/pbm.py
# SERVICE_TYPE = 'PbmServiceInstance'
# LOG = logging.getLogger(__name__)
# class Pbm(service.Service):
#     def __init__(self, protocol='https', host='localhost', port=443,
#                  wsdl_url=None, cacert=None, insecure=True, pool_maxsize=10,
#                  connection_timeout=None, op_id_prefix='oslo.vmware'):
#     def set_soap_cookie(self, cookie):
#     def retrieve_service_content(self):
#     def __repr__(self):
#     def __str__(self):
# def get_all_profiles(session):
# def get_profile_id_by_name(session, profile_name):
# def filter_hubs_by_profile(session, hubs, profile_id):
# def convert_datastores_to_hubs(pbm_client_factory, datastores):
# def filter_datastores_by_hubs(hubs, datastores):
# def get_pbm_wsdl_location(vc_version):
# def get_profiles(session, vm):
# def get_profiles_by_ids(session, profile_ids):
# 
# 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 os
import urllib.parse as urlparse
import urllib.request as urllib
from unittest import mock
from oslo_vmware import pbm
from oslo_vmware.tests import base
from oslo_vmware import vim_util
            self.assertEqual(session.pbm.service_content.profileManager,
                             args[0])
            if method == 'PbmQueryProfile':
                self.assertEqual('STORAGE',
                                 kwargs['resourceType'].resourceType)
                return profile_ids
            self.assertEqual(profile_ids, kwargs['profileIds'])

        session.invoke_api.side_effect = invoke_api_side_effect
        pbm.get_all_profiles(session)
        self.assertEqual(2, session.invoke_api.call_count)

    def test_get_all_profiles_with_no_profiles(self):
        session = mock.Mock()
        session.pbm = mock.Mock()
        session.invoke_api.return_value = []
        profiles = pbm.get_all_profiles(session)
        session.invoke_api.assert_called_once_with(
            session.pbm,
            'PbmQueryProfile',
            session.pbm.service_content.profileManager,
            resourceType=session.pbm.client.factory.create())
        self.assertEqual([], profiles)

    def _create_profile(self, profile_id, name):
        profile = mock.Mock()
        profile.profileId = profile_id
        profile.name = name
        return profile


# Path: oslo_vmware/pbm.py
# SERVICE_TYPE = 'PbmServiceInstance'
# LOG = logging.getLogger(__name__)
# class Pbm(service.Service):
#     def __init__(self, protocol='https', host='localhost', port=443,
#                  wsdl_url=None, cacert=None, insecure=True, pool_maxsize=10,
#                  connection_timeout=None, op_id_prefix='oslo.vmware'):
#     def set_soap_cookie(self, cookie):
#     def retrieve_service_content(self):
#     def __repr__(self):
#     def __str__(self):
# def get_all_profiles(session):
# def get_profile_id_by_name(session, profile_name):
# def filter_hubs_by_profile(session, hubs, profile_id):
# def convert_datastores_to_hubs(pbm_client_factory, datastores):
# def filter_datastores_by_hubs(hubs, datastores):
# def get_pbm_wsdl_location(vc_version):
# def get_profiles(session, vm):
# def get_profiles_by_ids(session, profile_ids):
# 
# 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_pbm.py
import os
import urllib.parse as urlparse
import urllib.request as urllib
from unittest import mock
from oslo_vmware import pbm
from oslo_vmware.tests import base
from oslo_vmware import vim_util

            self.assertEqual(session.pbm.service_content.profileManager,
                             args[0])
            if method == 'PbmQueryProfile':
                self.assertEqual('STORAGE',
                                 kwargs['resourceType'].resourceType)
                return profile_ids
            self.assertEqual(profile_ids, kwargs['profileIds'])

        session.invoke_api.side_effect = invoke_api_side_effect
        pbm.get_all_profiles(session)
        self.assertEqual(2, session.invoke_api.call_count)

    def test_get_all_profiles_with_no_profiles(self):
        session = mock.Mock()
        session.pbm = mock.Mock()
        session.invoke_api.return_value = []
        profiles = pbm.get_all_profiles(session)
        session.invoke_api.assert_called_once_with(
            session.pbm,
            'PbmQueryProfile',
            session.pbm.service_content.profileManager,
            resourceType=session.pbm.client.factory.create())
        self.assertEqual([], profiles)

    def _create_profile(self, profile_id, name):
        profile = mock.Mock()
        profile.profileId = profile_id
        profile.name = name
        return profile


    @mock.patch.object(pbm, 'get_all_profiles')