def test_get_client_with_token(self): client_args = {'endpoint_url': CONF.neutron_url, 'timeout': CONF.neutron_url_timeout, 'insecure': CONF.neutron_api_insecure, 'ca_cert': CONF.neutron_ca_certificates_file, 'token': 'test_token', 'auth_strategy': None} my_context = context.RequestContext('test_user', 'test_tenant', auth_token='test_token', is_admin=False) neutron.get_client(my_context) clientv20.Client.__init__.assert_called_once_with(**client_args)
def test_get_client_admin_context(self): client_args = {'endpoint_url': CONF.neutron_url, 'timeout': CONF.neutron_url_timeout, 'insecure': CONF.neutron_api_insecure, 'ca_cert': CONF.neutron_ca_certificates_file, 'username': CONF.neutron_admin_username, 'tenant_name': CONF.neutron_admin_tenant_name, 'password': CONF.neutron_admin_password, 'auth_url': CONF.neutron_admin_auth_url, 'auth_strategy': CONF.neutron_auth_strategy} my_context = context.RequestContext('test_user', 'test_tenant', is_admin=True) neutron.get_client(my_context) clientv20.Client.__init__.assert_called_once_with(**client_args)
def test_get_client_with_token(self): client_args = { 'endpoint_url': CONF.neutron_url, 'timeout': CONF.neutron_url_timeout, 'insecure': CONF.neutron_api_insecure, 'ca_cert': CONF.neutron_ca_certificates_file, 'token': 'test_token', 'auth_strategy': None } my_context = context.RequestContext('test_user', 'test_tenant', auth_token='test_token', is_admin=False) neutron.get_client(my_context) clientv20.Client.__init__.assert_called_once_with(**client_args)
def test_get_client_admin_context(self): client_args = { 'endpoint_url': CONF.neutron_url, 'timeout': CONF.neutron_url_timeout, 'insecure': CONF.neutron_api_insecure, 'ca_cert': CONF.neutron_ca_certificates_file, 'username': CONF.neutron_admin_username, 'tenant_name': CONF.neutron_admin_tenant_name, 'password': CONF.neutron_admin_password, 'auth_url': CONF.neutron_admin_auth_url, 'auth_strategy': CONF.neutron_auth_strategy } my_context = context.RequestContext('test_user', 'test_tenant', is_admin=True) neutron.get_client(my_context) clientv20.Client.__init__.assert_called_once_with(**client_args)
def __init__(self): super(API, self).__init__() self.last_neutron_extension_sync = None self.extensions = {} self.client = neutron.get_client(context.get_admin_context())