def test_keystone(self, keystone_client_class): context = mock.NonCallableMock( auth_token='fake_token', project_id='fake_project') res = clients.keystone(context) self.assertEqual(keystone_client_class.return_value.return_value, res) keystone_client_class.return_value.assert_called_with( auth_url='keystone_url', token='fake_token', tenant_id='fake_project', project_id='fake_project')
def test_keystone(self, keystone_client_class): context = mock.Mock( auth_token='fake_token', project_id='fake_project') res = clients.keystone(context) self.assertEqual(keystone_client_class.return_value.return_value, res) keystone_client_class.return_value.assert_called_with( auth_url='keystone_url', cacert=None, insecure=False, token='fake_token', tenant_id='fake_project', project_id='fake_project')
def _s3_conn(context): # NOTE(vish): access and secret keys for s3 server are not # checked in nova-objectstore ec2_creds = clients.keystone(context).ec2.list(context.user_id) access = ec2_creds[0].access if CONF.s3_affix_tenant: access = '%s:%s' % (access, context.project_id) secret = ec2_creds[0].secret calling = boto.s3.connection.OrdinaryCallingFormat() return boto.s3.connection.S3Connection(aws_access_key_id=access, aws_secret_access_key=secret, is_secure=CONF.s3_use_ssl, calling_format=calling, port=CONF.s3_port, host=CONF.s3_host)
def _s3_conn(context): # NOTE(vish): access and secret keys for s3 server are not # checked in nova-objectstore ec2_creds = clients.keystone(context).ec2.list(context.user_id) access = ec2_creds[0].access if CONF.s3_affix_tenant: access = '%s:%s' % (access, context.project_id) secret = ec2_creds[0].secret calling = boto.s3.connection.OrdinaryCallingFormat() return boto.s3.connection.S3Connection(aws_access_key_id=access, aws_secret_access_key=secret, is_secure=CONF.s3_use_ssl, calling_format=calling, port=CONF.s3_port, host=CONF.s3_host)
def test_keystone(self, keystone): context = mock.NonCallableMock(session=mock.sentinel.session) res = clients.keystone(context) self.assertEqual(keystone.return_value, res) keystone.assert_called_with(auth_url="http://localhost:5000/v2.0", session=mock.sentinel.session)
def test_keystone(self, keystone): context = mock.NonCallableMock(session=mock.sentinel.session) res = clients.keystone(context) self.assertEqual(keystone.return_value, res) keystone.assert_called_with(auth_url='http://localhost:5000/v2.0', session=mock.sentinel.session)
def test_keystone(self, keystone_client_class): context = mock.NonCallableMock(session=mock.sentinel.session) res = clients.keystone(context) self.assertEqual(keystone_client_class.return_value.return_value, res) keystone_client_class.return_value.assert_called_with( session=mock.sentinel.session)
def test_keystone(self, keystone_client_class): context = mock.NonCallableMock(session=mock.sentinel.session) res = clients.keystone(context) self.assertEqual(keystone_client_class.return_value.return_value, res) keystone_client_class.return_value.assert_called_with( session=mock.sentinel.session)