Switch config deferred_auth_method to trusts by default
Change deferred_auth_method to trusts by default, and fixes unittests error. Closes-Bug: #1286157 Change-Id: Ifebbc1b5d71458d8502e08bcacbd94b7437128f9
This commit is contained in:
parent
ead3f0acf2
commit
2cb0e674f3
@ -57,7 +57,6 @@ class NeutronExtraRouteTest(common.HeatTestCase):
|
|||||||
super(NeutronExtraRouteTest, self).setUp()
|
super(NeutronExtraRouteTest, self).setUp()
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_router')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_router')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_router')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
resource._register_class("OS::Neutron::ExtraRoute",
|
resource._register_class("OS::Neutron::ExtraRoute",
|
||||||
extraroute.ExtraRoute)
|
extraroute.ExtraRoute)
|
||||||
|
@ -71,7 +71,6 @@ class CloudServersTest(common.HeatTestCase):
|
|||||||
'nova')._create = mock_nova_create
|
'nova')._create = mock_nova_create
|
||||||
mock_nova_create.return_value = self.fc
|
mock_nova_create.return_value = self.fc
|
||||||
|
|
||||||
self.stub_keystoneclient()
|
|
||||||
# Test environment may not have pyrax client library installed and if
|
# Test environment may not have pyrax client library installed and if
|
||||||
# pyrax is not installed resource class would not be registered.
|
# pyrax is not installed resource class would not be registered.
|
||||||
# So register resource provider class explicitly for unit testing.
|
# So register resource provider class explicitly for unit testing.
|
||||||
|
@ -99,7 +99,7 @@ engine_opts = [
|
|||||||
help=_('The directory to search for environment files.')),
|
help=_('The directory to search for environment files.')),
|
||||||
cfg.StrOpt('deferred_auth_method',
|
cfg.StrOpt('deferred_auth_method',
|
||||||
choices=['password', 'trusts'],
|
choices=['password', 'trusts'],
|
||||||
default='password',
|
default='trusts',
|
||||||
help=_('Select deferred auth method, '
|
help=_('Select deferred auth method, '
|
||||||
'stored password or trusts.')),
|
'stored password or trusts.')),
|
||||||
cfg.ListOpt('trusts_delegated_roles',
|
cfg.ListOpt('trusts_delegated_roles',
|
||||||
|
@ -35,7 +35,6 @@ class TestAutoScalingGroupValidation(common.HeatTestCase):
|
|||||||
generic_resource.ResourceWithPropsAndAttrs)
|
generic_resource.ResourceWithPropsAndAttrs)
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.parsed = template_format.parse(inline_templates.as_heat_template)
|
self.parsed = template_format.parse(inline_templates.as_heat_template)
|
||||||
|
|
||||||
def test_invalid_min_size(self):
|
def test_invalid_min_size(self):
|
||||||
@ -96,7 +95,6 @@ class TestInitialGroupSize(common.HeatTestCase):
|
|||||||
super(TestInitialGroupSize, self).setUp()
|
super(TestInitialGroupSize, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def test_initial_size(self):
|
def test_initial_size(self):
|
||||||
t = template_format.parse(inline_templates.as_heat_template)
|
t = template_format.parse(inline_templates.as_heat_template)
|
||||||
@ -118,7 +116,6 @@ class TestGroupAdjust(common.HeatTestCase):
|
|||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
resource._register_class('ResourceWithPropsAndAttrs',
|
resource._register_class('ResourceWithPropsAndAttrs',
|
||||||
generic_resource.ResourceWithPropsAndAttrs)
|
generic_resource.ResourceWithPropsAndAttrs)
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
t = template_format.parse(inline_templates.as_heat_template)
|
t = template_format.parse(inline_templates.as_heat_template)
|
||||||
stack = utils.parse_stack(t, params=inline_templates.as_params)
|
stack = utils.parse_stack(t, params=inline_templates.as_params)
|
||||||
@ -230,7 +227,6 @@ class TestGroupCrud(common.HeatTestCase):
|
|||||||
generic_resource.ResourceWithPropsAndAttrs)
|
generic_resource.ResourceWithPropsAndAttrs)
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.stub_ImageConstraint_validate()
|
self.stub_ImageConstraint_validate()
|
||||||
self.stub_FlavorConstraint_validate()
|
self.stub_FlavorConstraint_validate()
|
||||||
self.stub_SnapshotConstraint_validate()
|
self.stub_SnapshotConstraint_validate()
|
||||||
@ -312,7 +308,6 @@ class HeatScalingGroupAttrTest(common.HeatTestCase):
|
|||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
resource._register_class('ResourceWithPropsAndAttrs',
|
resource._register_class('ResourceWithPropsAndAttrs',
|
||||||
generic_resource.ResourceWithPropsAndAttrs)
|
generic_resource.ResourceWithPropsAndAttrs)
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
t = template_format.parse(inline_templates.as_heat_template)
|
t = template_format.parse(inline_templates.as_heat_template)
|
||||||
stack = utils.parse_stack(t, params=inline_templates.as_params)
|
stack = utils.parse_stack(t, params=inline_templates.as_params)
|
||||||
|
@ -35,7 +35,6 @@ class TestAutoScalingPolicy(common.HeatTestCase):
|
|||||||
super(TestAutoScalingPolicy, self).setUp()
|
super(TestAutoScalingPolicy, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_scaling_policy(self, t, stack, resource_name):
|
def create_scaling_policy(self, t, stack, resource_name):
|
||||||
rsrc = stack[resource_name]
|
rsrc = stack[resource_name]
|
||||||
@ -101,7 +100,6 @@ class TestCooldownMixin(common.HeatTestCase):
|
|||||||
super(TestCooldownMixin, self).setUp()
|
super(TestCooldownMixin, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_scaling_policy(self, t, stack, resource_name):
|
def create_scaling_policy(self, t, stack, resource_name):
|
||||||
rsrc = stack[resource_name]
|
rsrc = stack[resource_name]
|
||||||
@ -177,7 +175,6 @@ class TestCooldownMixin(common.HeatTestCase):
|
|||||||
class ScalingPolicyAttrTest(common.HeatTestCase):
|
class ScalingPolicyAttrTest(common.HeatTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ScalingPolicyAttrTest, self).setUp()
|
super(ScalingPolicyAttrTest, self).setUp()
|
||||||
self.stub_keystoneclient()
|
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
t = template_format.parse(as_template)
|
t = template_format.parse(as_template)
|
||||||
|
@ -30,7 +30,6 @@ class LaunchConfigurationTest(common.HeatTestCase):
|
|||||||
super(LaunchConfigurationTest, self).setUp()
|
super(LaunchConfigurationTest, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def validate_launch_config(self, t, stack, resource_name):
|
def validate_launch_config(self, t, stack, resource_name):
|
||||||
# create the launch configuration resource
|
# create the launch configuration resource
|
||||||
|
@ -38,7 +38,6 @@ class TestAutoScalingGroupValidation(common.HeatTestCase):
|
|||||||
super(TestAutoScalingGroupValidation, self).setUp()
|
super(TestAutoScalingGroupValidation, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def validate_scaling_group(self, t, stack, resource_name):
|
def validate_scaling_group(self, t, stack, resource_name):
|
||||||
# create the launch configuration resource
|
# create the launch configuration resource
|
||||||
@ -277,7 +276,6 @@ class TestInitialGroupSize(common.HeatTestCase):
|
|||||||
super(TestInitialGroupSize, self).setUp()
|
super(TestInitialGroupSize, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def test_initial_size(self):
|
def test_initial_size(self):
|
||||||
t = template_format.parse(as_template)
|
t = template_format.parse(as_template)
|
||||||
@ -297,7 +295,6 @@ class TestGroupAdjust(common.HeatTestCase):
|
|||||||
super(TestGroupAdjust, self).setUp()
|
super(TestGroupAdjust, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
t = template_format.parse(as_template)
|
t = template_format.parse(as_template)
|
||||||
stack = utils.parse_stack(t, params=inline_templates.as_params)
|
stack = utils.parse_stack(t, params=inline_templates.as_params)
|
||||||
@ -407,7 +404,6 @@ class TestGroupCrud(common.HeatTestCase):
|
|||||||
super(TestGroupCrud, self).setUp()
|
super(TestGroupCrud, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
t = template_format.parse(as_template)
|
t = template_format.parse(as_template)
|
||||||
stack = utils.parse_stack(t, params=inline_templates.as_params)
|
stack = utils.parse_stack(t, params=inline_templates.as_params)
|
||||||
|
@ -35,7 +35,6 @@ class TestAutoScalingPolicy(common.HeatTestCase):
|
|||||||
super(TestAutoScalingPolicy, self).setUp()
|
super(TestAutoScalingPolicy, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_scaling_policy(self, t, stack, resource_name):
|
def create_scaling_policy(self, t, stack, resource_name):
|
||||||
rsrc = stack[resource_name]
|
rsrc = stack[resource_name]
|
||||||
@ -102,7 +101,6 @@ class TestCooldownMixin(common.HeatTestCase):
|
|||||||
super(TestCooldownMixin, self).setUp()
|
super(TestCooldownMixin, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_scaling_policy(self, t, stack, resource_name):
|
def create_scaling_policy(self, t, stack, resource_name):
|
||||||
rsrc = stack[resource_name]
|
rsrc = stack[resource_name]
|
||||||
@ -178,7 +176,6 @@ class TestCooldownMixin(common.HeatTestCase):
|
|||||||
class ScalingPolicyAttrTest(common.HeatTestCase):
|
class ScalingPolicyAttrTest(common.HeatTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ScalingPolicyAttrTest, self).setUp()
|
super(ScalingPolicyAttrTest, self).setUp()
|
||||||
self.stub_keystoneclient()
|
|
||||||
t = template_format.parse(as_template)
|
t = template_format.parse(as_template)
|
||||||
stack = utils.parse_stack(t, params=as_params)
|
stack = utils.parse_stack(t, params=as_params)
|
||||||
self.policy = stack['WebServerScaleUpPolicy']
|
self.policy = stack['WebServerScaleUpPolicy']
|
||||||
|
@ -80,7 +80,6 @@ class WaitConditionTest(common.HeatTestCase):
|
|||||||
super(WaitConditionTest, self).setUp()
|
super(WaitConditionTest, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_stack(self, stack_id=None,
|
def create_stack(self, stack_id=None,
|
||||||
template=test_template_waitcondition, params=None,
|
template=test_template_waitcondition, params=None,
|
||||||
@ -353,7 +352,6 @@ class WaitConditionHandleTest(common.HeatTestCase):
|
|||||||
super(WaitConditionHandleTest, self).setUp()
|
super(WaitConditionHandleTest, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_stack(self, stack_name=None, stack_id=None):
|
def create_stack(self, stack_name=None, stack_id=None):
|
||||||
temp = template_format.parse(test_template_waitcondition)
|
temp = template_format.parse(test_template_waitcondition)
|
||||||
@ -524,7 +522,6 @@ class WaitConditionUpdateTest(common.HeatTestCase):
|
|||||||
super(WaitConditionUpdateTest, self).setUp()
|
super(WaitConditionUpdateTest, self).setUp()
|
||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_stack(self, tmpl=None):
|
def create_stack(self, tmpl=None):
|
||||||
if tmpl is None:
|
if tmpl is None:
|
||||||
|
@ -72,7 +72,7 @@ class HeatTestCase(testscenarios.WithScenarios,
|
|||||||
|
|
||||||
TIME_STEP = 0.1
|
TIME_STEP = 0.1
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self, mock_keystone=True):
|
||||||
super(HeatTestCase, self).setUp()
|
super(HeatTestCase, self).setUp()
|
||||||
self.m = mox.Mox()
|
self.m = mox.Mox()
|
||||||
self.addCleanup(self.m.UnsetStubs)
|
self.addCleanup(self.m.UnsetStubs)
|
||||||
@ -112,7 +112,8 @@ class HeatTestCase(testscenarios.WithScenarios,
|
|||||||
# use CWLiteAlarm for testing.
|
# use CWLiteAlarm for testing.
|
||||||
resources.global_env().registry.load(
|
resources.global_env().registry.load(
|
||||||
{"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm"})
|
{"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm"})
|
||||||
|
if mock_keystone:
|
||||||
|
self.stub_keystoneclient()
|
||||||
utils.setup_dummy_db()
|
utils.setup_dummy_db()
|
||||||
self.addCleanup(utils.reset_dummy_db)
|
self.addCleanup(utils.reset_dummy_db)
|
||||||
|
|
||||||
|
@ -96,9 +96,10 @@ class FakeAuth(auth.BaseAuthPlugin):
|
|||||||
|
|
||||||
|
|
||||||
class FakeKeystoneClient(object):
|
class FakeKeystoneClient(object):
|
||||||
def __init__(self, username='test_user', password='apassword',
|
def __init__(self, username='test_username', password='password',
|
||||||
user_id='1234', access='4567', secret='8901',
|
user_id='1234', access='4567', secret='8901',
|
||||||
credential_id='abcdxyz'):
|
credential_id='abcdxyz', auth_token='abcd1234',
|
||||||
|
context=None):
|
||||||
self.username = username
|
self.username = username
|
||||||
self.password = password
|
self.password = password
|
||||||
self.user_id = user_id
|
self.user_id = user_id
|
||||||
@ -106,6 +107,8 @@ class FakeKeystoneClient(object):
|
|||||||
self.secret = secret
|
self.secret = secret
|
||||||
self.session = session.Session()
|
self.session = session.Session()
|
||||||
self.credential_id = credential_id
|
self.credential_id = credential_id
|
||||||
|
self.token = auth_token
|
||||||
|
self.context = context
|
||||||
|
|
||||||
class FakeCred(object):
|
class FakeCred(object):
|
||||||
id = self.credential_id
|
id = self.credential_id
|
||||||
@ -183,3 +186,10 @@ class FakeKeystoneClient(object):
|
|||||||
|
|
||||||
def stack_domain_user_token(self, user_id, project_id, password):
|
def stack_domain_user_token(self, user_id, project_id, password):
|
||||||
return 'adomainusertoken'
|
return 'adomainusertoken'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def auth_token(self):
|
||||||
|
if self.context is not None:
|
||||||
|
return self.context.auth_plugin.get_token(self.session)
|
||||||
|
else:
|
||||||
|
return self.token
|
@ -72,7 +72,6 @@ class HeatWaitConditionTest(common.HeatTestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(HeatWaitConditionTest, self).setUp()
|
super(HeatWaitConditionTest, self).setUp()
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.tenant_id = 'test_tenant'
|
self.tenant_id = 'test_tenant'
|
||||||
|
|
||||||
def create_stack(self, stack_id=None,
|
def create_stack(self, stack_id=None,
|
||||||
|
@ -121,7 +121,6 @@ class CeilometerAlarmTest(common.HeatTestCase):
|
|||||||
cfg.CONF.set_default('heat_waitcondition_server_url',
|
cfg.CONF.set_default('heat_waitcondition_server_url',
|
||||||
'http://server.test:8000/v1/waitcondition')
|
'http://server.test:8000/v1/waitcondition')
|
||||||
|
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.fa = mock.Mock()
|
self.fa = mock.Mock()
|
||||||
|
|
||||||
def create_stack(self, template=None):
|
def create_stack(self, template=None):
|
||||||
|
@ -95,6 +95,7 @@ class ClientsTest(common.HeatTestCase):
|
|||||||
con.tenant_id = "b363706f891f48019483f8bd6503c54b"
|
con.tenant_id = "b363706f891f48019483f8bd6503c54b"
|
||||||
con.auth_token = None
|
con.auth_token = None
|
||||||
con.auth_plugin = fakes.FakeAuth(auth_token='anewtoken')
|
con.auth_plugin = fakes.FakeAuth(auth_token='anewtoken')
|
||||||
|
self.stub_keystoneclient(context=con)
|
||||||
c = clients.Clients(con)
|
c = clients.Clients(con)
|
||||||
con.clients = c
|
con.clients = c
|
||||||
|
|
||||||
@ -200,6 +201,13 @@ class ClientPluginTest(common.HeatTestCase):
|
|||||||
@mock.patch.object(context, "RequestContext")
|
@mock.patch.object(context, "RequestContext")
|
||||||
@mock.patch.object(v3, "Token", name="v3_token")
|
@mock.patch.object(v3, "Token", name="v3_token")
|
||||||
def test_get_missing_service_catalog(self, mock_v3, mkreqctx):
|
def test_get_missing_service_catalog(self, mock_v3, mkreqctx):
|
||||||
|
class FakeKeystone(fakes.FakeKeystoneClient):
|
||||||
|
def __init__(self):
|
||||||
|
super(FakeKeystone, self).__init__()
|
||||||
|
self.client = self
|
||||||
|
self.version = 'v3'
|
||||||
|
|
||||||
|
self.stub_keystoneclient(fake_client=FakeKeystone())
|
||||||
con = mock.Mock(auth_token="1234", trust_id=None)
|
con = mock.Mock(auth_token="1234", trust_id=None)
|
||||||
c = clients.Clients(con)
|
c = clients.Clients(con)
|
||||||
con.clients = c
|
con.clients = c
|
||||||
@ -213,6 +221,7 @@ class ClientPluginTest(common.HeatTestCase):
|
|||||||
mock_token_obj = mock.Mock()
|
mock_token_obj = mock.Mock()
|
||||||
mock_token_obj.get_auth_ref.return_value = {'catalog': 'foo'}
|
mock_token_obj.get_auth_ref.return_value = {'catalog': 'foo'}
|
||||||
mock_v3.return_value = mock_token_obj
|
mock_v3.return_value = mock_token_obj
|
||||||
|
|
||||||
plugin = FooClientsPlugin(con)
|
plugin = FooClientsPlugin(con)
|
||||||
mock_cxt_dict = {'auth_token_info': {'token': {'catalog': 'baz'}}}
|
mock_cxt_dict = {'auth_token_info': {'token': {'catalog': 'baz'}}}
|
||||||
plugin.context.to_dict.return_value = mock_cxt_dict
|
plugin.context.to_dict.return_value = mock_cxt_dict
|
||||||
|
@ -391,7 +391,6 @@ class AllocTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'list_routers')
|
self.m.StubOutWithMock(neutronclient.Client, 'list_routers')
|
||||||
self.m.StubOutWithMock(neutronclient.Client,
|
self.m.StubOutWithMock(neutronclient.Client,
|
||||||
'remove_gateway_router')
|
'remove_gateway_router')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def _setup_test_stack(self, stack_name):
|
def _setup_test_stack(self, stack_name):
|
||||||
t = template_format.parse(ipassoc_template_validate)
|
t = template_format.parse(ipassoc_template_validate)
|
||||||
|
@ -211,7 +211,8 @@ def setup_mock_for_image_constraint(mocks, imageId_input,
|
|||||||
imageId_input).MultipleTimes().AndReturn(imageId_output)
|
imageId_input).MultipleTimes().AndReturn(imageId_output)
|
||||||
|
|
||||||
|
|
||||||
def setup_mocks(mocks, stack, mock_image_constraint=True):
|
def setup_mocks(mocks, stack, mock_image_constraint=True,
|
||||||
|
mock_keystone=True):
|
||||||
fc = fakes_v1_1.FakeClient()
|
fc = fakes_v1_1.FakeClient()
|
||||||
mocks.StubOutWithMock(instances.Instance, 'nova')
|
mocks.StubOutWithMock(instances.Instance, 'nova')
|
||||||
instances.Instance.nova().MultipleTimes().AndReturn(fc)
|
instances.Instance.nova().MultipleTimes().AndReturn(fc)
|
||||||
@ -223,7 +224,8 @@ def setup_mocks(mocks, stack, mock_image_constraint=True):
|
|||||||
setup_mock_for_image_constraint(mocks,
|
setup_mock_for_image_constraint(mocks,
|
||||||
instance.t['Properties']['ImageId'])
|
instance.t['Properties']['ImageId'])
|
||||||
|
|
||||||
setup_keystone_mocks(mocks, stack)
|
if mock_keystone:
|
||||||
|
setup_keystone_mocks(mocks, stack)
|
||||||
|
|
||||||
user_data = instance.properties['UserData']
|
user_data = instance.properties['UserData']
|
||||||
server_userdata = instance.client_plugin().build_userdata(
|
server_userdata = instance.client_plugin().build_userdata(
|
||||||
@ -415,7 +417,7 @@ class StackCreateTest(common.HeatTestCase):
|
|||||||
def test_wordpress_single_instance_stack_delete(self):
|
def test_wordpress_single_instance_stack_delete(self):
|
||||||
ctx = utils.dummy_context()
|
ctx = utils.dummy_context()
|
||||||
stack = get_wordpress_stack('test_stack', ctx)
|
stack = get_wordpress_stack('test_stack', ctx)
|
||||||
fc = setup_mocks(self.m, stack)
|
fc = setup_mocks(self.m, stack, mock_keystone=False)
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
stack_id = stack.store()
|
stack_id = stack.store()
|
||||||
stack.create()
|
stack.create()
|
||||||
@ -669,6 +671,7 @@ class StackServiceCreateUpdateDeleteTest(common.HeatTestCase):
|
|||||||
stack.t.t, {}, None, {})
|
stack.t.t, {}, None, {})
|
||||||
|
|
||||||
def test_stack_create_no_credentials(self):
|
def test_stack_create_no_credentials(self):
|
||||||
|
cfg.CONF.set_default('deferred_auth_method', 'password')
|
||||||
stack_name = 'test_stack_create_no_credentials'
|
stack_name = 'test_stack_create_no_credentials'
|
||||||
params = {'foo': 'bar'}
|
params = {'foo': 'bar'}
|
||||||
template = '{ "Template": "data" }'
|
template = '{ "Template": "data" }'
|
||||||
@ -1351,6 +1354,7 @@ class StackServiceCreateUpdateDeleteTest(common.HeatTestCase):
|
|||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
def test_stack_update_no_credentials(self):
|
def test_stack_update_no_credentials(self):
|
||||||
|
cfg.CONF.set_default('deferred_auth_method', 'password')
|
||||||
stack_name = 'test_stack_update_no_credentials'
|
stack_name = 'test_stack_update_no_credentials'
|
||||||
params = {'foo': 'bar'}
|
params = {'foo': 'bar'}
|
||||||
template = '{ "Template": "data" }'
|
template = '{ "Template": "data" }'
|
||||||
|
@ -149,7 +149,6 @@ class MetadataRefreshTest(common.HeatTestCase):
|
|||||||
'''
|
'''
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MetadataRefreshTest, self).setUp()
|
super(MetadataRefreshTest, self).setUp()
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_stack(self, stack_name='test_stack', params=None):
|
def create_stack(self, stack_name='test_stack', params=None):
|
||||||
params = params or {}
|
params = params or {}
|
||||||
@ -211,7 +210,6 @@ class MetadataRefreshTest(common.HeatTestCase):
|
|||||||
class WaitCondMetadataUpdateTest(common.HeatTestCase):
|
class WaitCondMetadataUpdateTest(common.HeatTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(WaitCondMetadataUpdateTest, self).setUp()
|
super(WaitCondMetadataUpdateTest, self).setUp()
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.patch('heat.engine.service.warnings')
|
self.patch('heat.engine.service.warnings')
|
||||||
|
|
||||||
self.man = service.EngineService('a-host', 'a-topic')
|
self.man = service.EngineService('a-host', 'a-topic')
|
||||||
@ -309,7 +307,6 @@ class MetadataRefreshTestServer(common.HeatTestCase):
|
|||||||
'''
|
'''
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(MetadataRefreshTestServer, self).setUp()
|
super(MetadataRefreshTestServer, self).setUp()
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_stack(self, stack_name='test_stack_native', params=None):
|
def create_stack(self, stack_name='test_stack_native', params=None):
|
||||||
params = params or {}
|
params = params or {}
|
||||||
|
@ -44,7 +44,6 @@ class NetworkInterfaceTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'create_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_port')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_port')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_port')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def mock_show_subnet(self):
|
def mock_show_subnet(self):
|
||||||
neutronclient.Client.show_subnet('ssss').AndReturn({
|
neutronclient.Client.show_subnet('ssss').AndReturn({
|
||||||
|
@ -725,7 +725,6 @@ class NeutronNetTest(common.HeatTestCase):
|
|||||||
'remove_network_from_dhcp_agent')
|
'remove_network_from_dhcp_agent')
|
||||||
self.m.StubOutWithMock(neutronclient.Client,
|
self.m.StubOutWithMock(neutronclient.Client,
|
||||||
'list_dhcp_agent_hosting_networks')
|
'list_dhcp_agent_hosting_networks')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_net(self, t, stack, resource_name):
|
def create_net(self, t, stack, resource_name):
|
||||||
resource_defns = stack.t.resource_definitions(stack)
|
resource_defns = stack.t.resource_definitions(stack)
|
||||||
@ -918,7 +917,6 @@ class NeutronProviderNetTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_network')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_network')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_network')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_network')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_provider_net(self):
|
def create_provider_net(self):
|
||||||
# Create script
|
# Create script
|
||||||
@ -1037,7 +1035,6 @@ class NeutronSubnetTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_subnet')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_subnet')
|
||||||
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_subnet(self, t, stack, resource_name):
|
def create_subnet(self, t, stack, resource_name):
|
||||||
resource_defns = stack.t.resource_definitions(stack)
|
resource_defns = stack.t.resource_definitions(stack)
|
||||||
@ -1436,7 +1433,6 @@ class NeutronRouterTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client,
|
self.m.StubOutWithMock(neutronclient.Client,
|
||||||
'list_l3_agent_hosting_routers')
|
'list_l3_agent_hosting_routers')
|
||||||
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_router(self, t, stack, resource_name):
|
def create_router(self, t, stack, resource_name):
|
||||||
resource_defns = stack.t.resource_definitions(stack)
|
resource_defns = stack.t.resource_definitions(stack)
|
||||||
@ -2197,7 +2193,6 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_port')
|
||||||
self.m.StubOutWithMock(neutronV20,
|
self.m.StubOutWithMock(neutronV20,
|
||||||
'find_resourceid_by_name_or_id')
|
'find_resourceid_by_name_or_id')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def test_floating_ip_router_interface(self):
|
def test_floating_ip_router_interface(self):
|
||||||
t = template_format.parse(neutron_floating_template)
|
t = template_format.parse(neutron_floating_template)
|
||||||
@ -2704,7 +2699,6 @@ class NeutronPortTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_port')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_port')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_subnet')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_subnet')
|
||||||
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def test_missing_subnet_id(self):
|
def test_missing_subnet_id(self):
|
||||||
neutronV20.find_resourceid_by_name_or_id(
|
neutronV20.find_resourceid_by_name_or_id(
|
||||||
|
@ -93,7 +93,6 @@ class FirewallTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_firewall')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_firewall')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_firewall')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_firewall')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_firewall')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_firewall')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_firewall(self):
|
def create_firewall(self):
|
||||||
neutronclient.Client.create_firewall({
|
neutronclient.Client.create_firewall({
|
||||||
@ -222,7 +221,6 @@ class FirewallPolicyTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_firewall_policy')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_firewall_policy')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_firewall_policy')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_firewall_policy')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_firewall_policy')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_firewall_policy')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_firewall_policy(self):
|
def create_firewall_policy(self):
|
||||||
neutronclient.Client.create_firewall_policy({
|
neutronclient.Client.create_firewall_policy({
|
||||||
@ -348,7 +346,6 @@ class FirewallRuleTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_firewall_rule')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_firewall_rule')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_firewall_rule')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_firewall_rule')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_firewall_rule')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_firewall_rule')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_firewall_rule(self):
|
def create_firewall_rule(self):
|
||||||
neutronclient.Client.create_firewall_rule({
|
neutronclient.Client.create_firewall_rule({
|
||||||
|
@ -229,7 +229,6 @@ class HealthMonitorTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_health_monitor')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_health_monitor')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_health_monitor')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_health_monitor')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_health_monitor')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_health_monitor')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_health_monitor(self):
|
def create_health_monitor(self):
|
||||||
neutronclient.Client.create_health_monitor({
|
neutronclient.Client.create_health_monitor({
|
||||||
@ -362,7 +361,6 @@ class PoolTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_vip')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_vip')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_vip')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_vip')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_pool(self, resolve_neutron=True, with_vip_subnet=False):
|
def create_pool(self, resolve_neutron=True, with_vip_subnet=False):
|
||||||
neutronclient.Client.create_pool({
|
neutronclient.Client.create_pool({
|
||||||
@ -854,7 +852,6 @@ class PoolMemberTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_member')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_member')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_member')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_member')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_member')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_member')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_member(self):
|
def create_member(self):
|
||||||
neutronclient.Client.create_member({
|
neutronclient.Client.create_member({
|
||||||
@ -954,7 +951,6 @@ class LoadBalancerTest(common.HeatTestCase):
|
|||||||
self.fc = fakes_v1_1.FakeClient()
|
self.fc = fakes_v1_1.FakeClient()
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'create_member')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_member')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_member')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_member')
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
|
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
|
||||||
|
|
||||||
def create_load_balancer(self):
|
def create_load_balancer(self):
|
||||||
@ -1052,7 +1048,6 @@ class PoolUpdateHealthMonitorsTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'create_vip')
|
self.m.StubOutWithMock(neutronclient.Client, 'create_vip')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_vip')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_vip')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_vip')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_vip')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def _create_pool_with_health_monitors(self):
|
def _create_pool_with_health_monitors(self):
|
||||||
neutronclient.Client.create_health_monitor({
|
neutronclient.Client.create_health_monitor({
|
||||||
|
@ -64,7 +64,6 @@ class MeteringLabelTest(common.HeatTestCase):
|
|||||||
'delete_metering_label_rule')
|
'delete_metering_label_rule')
|
||||||
self.m.StubOutWithMock(neutronclient.Client,
|
self.m.StubOutWithMock(neutronclient.Client,
|
||||||
'show_metering_label_rule')
|
'show_metering_label_rule')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_metering_label(self):
|
def create_metering_label(self):
|
||||||
neutronclient.Client.create_metering_label({
|
neutronclient.Client.create_metering_label({
|
||||||
@ -177,7 +176,6 @@ class MeteringRuleTest(common.HeatTestCase):
|
|||||||
'delete_metering_label_rule')
|
'delete_metering_label_rule')
|
||||||
self.m.StubOutWithMock(neutronclient.Client,
|
self.m.StubOutWithMock(neutronclient.Client,
|
||||||
'show_metering_label_rule')
|
'show_metering_label_rule')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_metering_label_rule(self):
|
def create_metering_label_rule(self):
|
||||||
neutronclient.Client.create_metering_label_rule({
|
neutronclient.Client.create_metering_label_rule({
|
||||||
|
@ -104,7 +104,6 @@ class NeutronNetworkGatewayTest(common.HeatTestCase):
|
|||||||
'disconnect_network_gateway')
|
'disconnect_network_gateway')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'list_networks')
|
self.m.StubOutWithMock(neutronclient.Client, 'list_networks')
|
||||||
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def mock_create_fail_network_not_found_delete_success(self):
|
def mock_create_fail_network_not_found_delete_success(self):
|
||||||
neutronclient.Client.create_network_gateway({
|
neutronclient.Client.create_network_gateway({
|
||||||
|
@ -86,7 +86,6 @@ Resources:
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(SecurityGroupTest, self).setUp()
|
super(SecurityGroupTest, self).setUp()
|
||||||
self.fc = fakes_v1_1.FakeClient()
|
self.fc = fakes_v1_1.FakeClient()
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'create')
|
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'create')
|
||||||
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'delete')
|
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'delete')
|
||||||
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'create')
|
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'create')
|
||||||
|
@ -171,7 +171,6 @@ class VPNServiceTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_vpnservice')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_vpnservice')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_vpnservice')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_vpnservice')
|
||||||
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
self.m.StubOutWithMock(neutronV20, 'find_resourceid_by_name_or_id')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_vpnservice(self, resolve_neutron=True, resolve_router=True):
|
def create_vpnservice(self, resolve_neutron=True, resolve_router=True):
|
||||||
self.stub_SubnetConstraint_validate()
|
self.stub_SubnetConstraint_validate()
|
||||||
@ -350,7 +349,6 @@ class IPsecSiteConnectionTest(common.HeatTestCase):
|
|||||||
'show_ipsec_site_connection')
|
'show_ipsec_site_connection')
|
||||||
self.m.StubOutWithMock(neutronclient.Client,
|
self.m.StubOutWithMock(neutronclient.Client,
|
||||||
'update_ipsec_site_connection')
|
'update_ipsec_site_connection')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_ipsec_site_connection(self):
|
def create_ipsec_site_connection(self):
|
||||||
neutronclient.Client.create_ipsec_site_connection(
|
neutronclient.Client.create_ipsec_site_connection(
|
||||||
@ -497,7 +495,6 @@ class IKEPolicyTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_ikepolicy')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_ikepolicy')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_ikepolicy')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_ikepolicy')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_ikepolicy')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_ikepolicy')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_ikepolicy(self):
|
def create_ikepolicy(self):
|
||||||
neutronclient.Client.create_ikepolicy(
|
neutronclient.Client.create_ikepolicy(
|
||||||
@ -638,7 +635,6 @@ class IPsecPolicyTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(neutronclient.Client, 'delete_ipsecpolicy')
|
self.m.StubOutWithMock(neutronclient.Client, 'delete_ipsecpolicy')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'show_ipsecpolicy')
|
self.m.StubOutWithMock(neutronclient.Client, 'show_ipsecpolicy')
|
||||||
self.m.StubOutWithMock(neutronclient.Client, 'update_ipsecpolicy')
|
self.m.StubOutWithMock(neutronclient.Client, 'update_ipsecpolicy')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_ipsecpolicy(self):
|
def create_ipsecpolicy(self):
|
||||||
neutronclient.Client.create_ipsecpolicy(
|
neutronclient.Client.create_ipsecpolicy(
|
||||||
|
@ -69,7 +69,6 @@ class NovaFloatingIPTest(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(self.novaclient.servers, 'get')
|
self.m.StubOutWithMock(self.novaclient.servers, 'get')
|
||||||
self.m.StubOutWithMock(self.novaclient.servers, 'add_floating_ip')
|
self.m.StubOutWithMock(self.novaclient.servers, 'add_floating_ip')
|
||||||
self.m.StubOutWithMock(self.novaclient.servers, 'remove_floating_ip')
|
self.m.StubOutWithMock(self.novaclient.servers, 'remove_floating_ip')
|
||||||
self.stub_keystoneclient()
|
|
||||||
nova.NovaClientPlugin.get_server = mock.Mock(
|
nova.NovaClientPlugin.get_server = mock.Mock(
|
||||||
return_value=mock.MagicMock())
|
return_value=mock.MagicMock())
|
||||||
|
|
||||||
|
@ -98,7 +98,6 @@ class FakeVersion(object):
|
|||||||
class OSDBInstanceTest(common.HeatTestCase):
|
class OSDBInstanceTest(common.HeatTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(OSDBInstanceTest, self).setUp()
|
super(OSDBInstanceTest, self).setUp()
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.fc = self.m.CreateMockAnything()
|
self.fc = self.m.CreateMockAnything()
|
||||||
self.nova = self.m.CreateMockAnything()
|
self.nova = self.m.CreateMockAnything()
|
||||||
self.m.StubOutWithMock(trove.TroveClientPlugin, '_create')
|
self.m.StubOutWithMock(trove.TroveClientPlugin, '_create')
|
||||||
|
@ -70,7 +70,6 @@ class s3Test(common.HeatTestCase):
|
|||||||
self.m.StubOutWithMock(sc.Connection, 'get_container')
|
self.m.StubOutWithMock(sc.Connection, 'get_container')
|
||||||
self.m.StubOutWithMock(sc.Connection, 'delete_container')
|
self.m.StubOutWithMock(sc.Connection, 'delete_container')
|
||||||
self.m.StubOutWithMock(sc.Connection, 'get_auth')
|
self.m.StubOutWithMock(sc.Connection, 'get_auth')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_resource(self, t, stack, resource_name):
|
def create_resource(self, t, stack, resource_name):
|
||||||
resource_defns = stack.t.resource_definitions(stack)
|
resource_defns = stack.t.resource_definitions(stack)
|
||||||
|
@ -132,7 +132,6 @@ Resources:
|
|||||||
super(SecurityGroupTest, self).setUp()
|
super(SecurityGroupTest, self).setUp()
|
||||||
self.fc = fakes_v1_1.FakeClient()
|
self.fc = fakes_v1_1.FakeClient()
|
||||||
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
|
self.m.StubOutWithMock(nova.NovaClientPlugin, '_create')
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'create')
|
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'create')
|
||||||
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'delete')
|
self.m.StubOutWithMock(nova_sgr.SecurityGroupRuleManager, 'delete')
|
||||||
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'create')
|
self.m.StubOutWithMock(nova_sg.SecurityGroupManager, 'create')
|
||||||
|
@ -99,7 +99,6 @@ class ServersTest(common.HeatTestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(ServersTest, self).setUp()
|
super(ServersTest, self).setUp()
|
||||||
self.fc = fakes_v1_1.FakeClient()
|
self.fc = fakes_v1_1.FakeClient()
|
||||||
self.stub_keystoneclient()
|
|
||||||
self.limits = self.m.CreateMockAnything()
|
self.limits = self.m.CreateMockAnything()
|
||||||
self.limits.absolute = self._limits_absolute()
|
self.limits.absolute = self._limits_absolute()
|
||||||
|
|
||||||
|
@ -94,12 +94,12 @@ class SignalTest(common.HeatTestCase):
|
|||||||
self.m.VerifyAll()
|
self.m.VerifyAll()
|
||||||
|
|
||||||
def test_resource_data(self):
|
def test_resource_data(self):
|
||||||
self.stack = self.create_stack(stack_name='resource_data_test',
|
|
||||||
stub=False)
|
|
||||||
self.stub_keystoneclient(
|
self.stub_keystoneclient(
|
||||||
access='anaccesskey',
|
access='anaccesskey',
|
||||||
secret='verysecret',
|
secret='verysecret',
|
||||||
credential_id='mycredential')
|
credential_id='mycredential')
|
||||||
|
self.stack = self.create_stack(stack_name='resource_data_test',
|
||||||
|
stub=False)
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
|
|
||||||
self.stack.create()
|
self.stack.create()
|
||||||
|
@ -501,13 +501,6 @@ class StackTest(common.HeatTestCase):
|
|||||||
self.stack.state)
|
self.stack.state)
|
||||||
|
|
||||||
def test_abandon_nodelete_project(self):
|
def test_abandon_nodelete_project(self):
|
||||||
fkc = fakes.FakeKeystoneClient()
|
|
||||||
fkc.delete_stack_domain_project = mock.Mock()
|
|
||||||
|
|
||||||
self.m.StubOutWithMock(keystone.KeystoneClientPlugin, '_create')
|
|
||||||
keystone.KeystoneClientPlugin._create().AndReturn(fkc)
|
|
||||||
self.m.ReplayAll()
|
|
||||||
|
|
||||||
self.stack = stack.Stack(self.ctx, 'delete_trust', self.tmpl)
|
self.stack = stack.Stack(self.ctx, 'delete_trust', self.tmpl)
|
||||||
stack_id = self.stack.store()
|
stack_id = self.stack.store()
|
||||||
|
|
||||||
@ -522,7 +515,6 @@ class StackTest(common.HeatTestCase):
|
|||||||
self.assertIsNone(db_s)
|
self.assertIsNone(db_s)
|
||||||
self.assertEqual((stack.Stack.DELETE, stack.Stack.COMPLETE),
|
self.assertEqual((stack.Stack.DELETE, stack.Stack.COMPLETE),
|
||||||
self.stack.state)
|
self.stack.state)
|
||||||
self.assertFalse(fkc.delete_stack_domain_project.called)
|
|
||||||
|
|
||||||
def test_suspend_resume(self):
|
def test_suspend_resume(self):
|
||||||
self.m.ReplayAll()
|
self.m.ReplayAll()
|
||||||
@ -1107,6 +1099,7 @@ class StackTest(common.HeatTestCase):
|
|||||||
"""
|
"""
|
||||||
A user_creds entry is created on first stack store
|
A user_creds entry is created on first stack store
|
||||||
"""
|
"""
|
||||||
|
cfg.CONF.set_default('deferred_auth_method', 'password')
|
||||||
self.stack = stack.Stack(self.ctx, 'creds_stack', self.tmpl)
|
self.stack = stack.Stack(self.ctx, 'creds_stack', self.tmpl)
|
||||||
self.stack.store()
|
self.stack.store()
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ import time
|
|||||||
|
|
||||||
from keystoneclient import exceptions as kc_exceptions
|
from keystoneclient import exceptions as kc_exceptions
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common import heat_keystoneclient as hkc
|
from heat.common import heat_keystoneclient as hkc
|
||||||
@ -137,7 +136,6 @@ class StackTest(common.HeatTestCase):
|
|||||||
self.stack.state)
|
self.stack.state)
|
||||||
|
|
||||||
def test_delete_trust(self):
|
def test_delete_trust(self):
|
||||||
cfg.CONF.set_override('deferred_auth_method', 'trusts')
|
|
||||||
self.stub_keystoneclient()
|
self.stub_keystoneclient()
|
||||||
|
|
||||||
self.stack = stack.Stack(self.ctx, 'delete_trust', self.tmpl)
|
self.stack = stack.Stack(self.ctx, 'delete_trust', self.tmpl)
|
||||||
@ -154,17 +152,12 @@ class StackTest(common.HeatTestCase):
|
|||||||
self.stack.state)
|
self.stack.state)
|
||||||
|
|
||||||
def test_delete_trust_trustor(self):
|
def test_delete_trust_trustor(self):
|
||||||
cfg.CONF.set_override('deferred_auth_method', 'trusts')
|
self.stub_keystoneclient(user_id='thetrustor')
|
||||||
|
|
||||||
trustor_ctx = utils.dummy_context(user_id='thetrustor')
|
trustor_ctx = utils.dummy_context(user_id='thetrustor')
|
||||||
mock_kc = self.patchobject(hkc, 'KeystoneClient')
|
|
||||||
mock_kc.return_value = fakes.FakeKeystoneClient(user_id='thetrustor')
|
|
||||||
|
|
||||||
self.stack = stack.Stack(trustor_ctx, 'delete_trust_nt', self.tmpl)
|
self.stack = stack.Stack(trustor_ctx, 'delete_trust_nt', self.tmpl)
|
||||||
stack_id = self.stack.store()
|
stack_id = self.stack.store()
|
||||||
|
|
||||||
mock_kc.assert_called_once_with(trustor_ctx)
|
|
||||||
|
|
||||||
db_s = db_api.stack_get(self.ctx, stack_id)
|
db_s = db_api.stack_get(self.ctx, stack_id)
|
||||||
self.assertIsNotNone(db_s)
|
self.assertIsNotNone(db_s)
|
||||||
|
|
||||||
@ -181,8 +174,6 @@ class StackTest(common.HeatTestCase):
|
|||||||
self.stack.state)
|
self.stack.state)
|
||||||
|
|
||||||
def test_delete_trust_not_trustor(self):
|
def test_delete_trust_not_trustor(self):
|
||||||
cfg.CONF.set_override('deferred_auth_method', 'trusts')
|
|
||||||
|
|
||||||
# Stack gets created with trustor_ctx, deleted with other_ctx
|
# Stack gets created with trustor_ctx, deleted with other_ctx
|
||||||
# then the trust delete should be with stored_ctx
|
# then the trust delete should be with stored_ctx
|
||||||
trustor_ctx = utils.dummy_context(user_id='thetrustor')
|
trustor_ctx = utils.dummy_context(user_id='thetrustor')
|
||||||
@ -190,14 +181,13 @@ class StackTest(common.HeatTestCase):
|
|||||||
stored_ctx = utils.dummy_context(trust_id='thetrust')
|
stored_ctx = utils.dummy_context(trust_id='thetrust')
|
||||||
|
|
||||||
mock_kc = self.patchobject(hkc, 'KeystoneClient')
|
mock_kc = self.patchobject(hkc, 'KeystoneClient')
|
||||||
mock_kc.return_value = fakes.FakeKeystoneClient(user_id='thetrustor')
|
self.stub_keystoneclient(user_id='thetrustor')
|
||||||
|
|
||||||
mock_sc = self.patchobject(stack.Stack, 'stored_context')
|
mock_sc = self.patchobject(stack.Stack, 'stored_context')
|
||||||
mock_sc.return_value = stored_ctx
|
mock_sc.return_value = stored_ctx
|
||||||
|
|
||||||
self.stack = stack.Stack(trustor_ctx, 'delete_trust_nt', self.tmpl)
|
self.stack = stack.Stack(trustor_ctx, 'delete_trust_nt', self.tmpl)
|
||||||
stack_id = self.stack.store()
|
stack_id = self.stack.store()
|
||||||
mock_kc.assert_called_once_with(trustor_ctx)
|
|
||||||
|
|
||||||
db_s = db_api.stack_get(self.ctx, stack_id)
|
db_s = db_api.stack_get(self.ctx, stack_id)
|
||||||
self.assertIsNotNone(db_s)
|
self.assertIsNotNone(db_s)
|
||||||
@ -212,8 +202,6 @@ class StackTest(common.HeatTestCase):
|
|||||||
loaded_stack = stack.Stack.load(other_ctx, self.stack.id)
|
loaded_stack = stack.Stack.load(other_ctx, self.stack.id)
|
||||||
loaded_stack.delete()
|
loaded_stack.delete()
|
||||||
mock_sc.assert_called_with()
|
mock_sc.assert_called_with()
|
||||||
mock_kc.assert_has_calls([mock.call(trustor_ctx),
|
|
||||||
mock.call(stored_ctx)])
|
|
||||||
|
|
||||||
db_s = db_api.stack_get(other_ctx, stack_id)
|
db_s = db_api.stack_get(other_ctx, stack_id)
|
||||||
self.assertIsNone(db_s)
|
self.assertIsNone(db_s)
|
||||||
@ -221,8 +209,6 @@ class StackTest(common.HeatTestCase):
|
|||||||
loaded_stack.state)
|
loaded_stack.state)
|
||||||
|
|
||||||
def test_delete_trust_backup(self):
|
def test_delete_trust_backup(self):
|
||||||
cfg.CONF.set_override('deferred_auth_method', 'trusts')
|
|
||||||
|
|
||||||
class FakeKeystoneClientFail(fakes.FakeKeystoneClient):
|
class FakeKeystoneClientFail(fakes.FakeKeystoneClient):
|
||||||
def delete_trust(self, trust_id):
|
def delete_trust(self, trust_id):
|
||||||
raise Exception("Shouldn't delete")
|
raise Exception("Shouldn't delete")
|
||||||
@ -245,8 +231,6 @@ class StackTest(common.HeatTestCase):
|
|||||||
mock_kcp.assert_called_once_with()
|
mock_kcp.assert_called_once_with()
|
||||||
|
|
||||||
def test_delete_trust_nested(self):
|
def test_delete_trust_nested(self):
|
||||||
cfg.CONF.set_override('deferred_auth_method', 'trusts')
|
|
||||||
|
|
||||||
class FakeKeystoneClientFail(fakes.FakeKeystoneClient):
|
class FakeKeystoneClientFail(fakes.FakeKeystoneClient):
|
||||||
def delete_trust(self, trust_id):
|
def delete_trust(self, trust_id):
|
||||||
raise Exception("Shouldn't delete")
|
raise Exception("Shouldn't delete")
|
||||||
@ -274,8 +258,6 @@ class StackTest(common.HeatTestCase):
|
|||||||
self.stack.state)
|
self.stack.state)
|
||||||
|
|
||||||
def test_delete_trust_fail(self):
|
def test_delete_trust_fail(self):
|
||||||
cfg.CONF.set_override('deferred_auth_method', 'trusts')
|
|
||||||
|
|
||||||
class FakeKeystoneClientFail(fakes.FakeKeystoneClient):
|
class FakeKeystoneClientFail(fakes.FakeKeystoneClient):
|
||||||
def delete_trust(self, trust_id):
|
def delete_trust(self, trust_id):
|
||||||
raise kc_exceptions.Forbidden("Denied!")
|
raise kc_exceptions.Forbidden("Denied!")
|
||||||
@ -317,7 +299,7 @@ class StackTest(common.HeatTestCase):
|
|||||||
|
|
||||||
self.stack.delete()
|
self.stack.delete()
|
||||||
|
|
||||||
mock_kcp.assert_called_once_with()
|
mock_kcp.assert_called_with()
|
||||||
|
|
||||||
db_s = db_api.stack_get(self.ctx, stack_id)
|
db_s = db_api.stack_get(self.ctx, stack_id)
|
||||||
self.assertIsNone(db_s)
|
self.assertIsNone(db_s)
|
||||||
@ -429,7 +411,7 @@ class StackTest(common.HeatTestCase):
|
|||||||
|
|
||||||
self.stack.delete()
|
self.stack.delete()
|
||||||
|
|
||||||
mock_kcp.assert_called_once_with()
|
mock_kcp.assert_called_with()
|
||||||
self.assertEqual((stack.Stack.DELETE, stack.Stack.FAILED),
|
self.assertEqual((stack.Stack.DELETE, stack.Stack.FAILED),
|
||||||
self.stack.state)
|
self.stack.state)
|
||||||
self.assertIn('Error deleting project', self.stack.status_reason)
|
self.assertIn('Error deleting project', self.stack.status_reason)
|
||||||
|
@ -59,7 +59,6 @@ class VPCTestBase(common.HeatTestCase):
|
|||||||
neutronclient.Client, 'create_security_group_rule')
|
neutronclient.Client, 'create_security_group_rule')
|
||||||
self.m.StubOutWithMock(
|
self.m.StubOutWithMock(
|
||||||
neutronclient.Client, 'delete_security_group_rule')
|
neutronclient.Client, 'delete_security_group_rule')
|
||||||
self.stub_keystoneclient()
|
|
||||||
|
|
||||||
def create_stack(self, templ):
|
def create_stack(self, templ):
|
||||||
t = template_format.parse(templ)
|
t = template_format.parse(templ)
|
||||||
|
Loading…
Reference in New Issue
Block a user