Remove mox from openstack_v1/test_events
Change-Id: I7122ef89ff5c10ace73d2bc3964ae5f1feb304b9
This commit is contained in:
parent
71a961bcd5
commit
86fbb3d9bd
|
@ -93,13 +93,8 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
if nested_depth:
|
||||
engine_resp[0]['root_stack_id'] = dict(stack_identity)
|
||||
|
||||
self.m.StubOutWithMock(rpc_client.EngineClient, 'call')
|
||||
rpc_client.EngineClient.call(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
).AndReturn(engine_resp)
|
||||
self.m.ReplayAll()
|
||||
mock_call = self.patchobject(rpc_client.EngineClient, 'call',
|
||||
return_value=engine_resp)
|
||||
|
||||
result = self.controller.index(req, tenant_id=self.tenant,
|
||||
stack_name=stack_identity.stack_name,
|
||||
|
@ -130,7 +125,12 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
)
|
||||
|
||||
self.assertEqual(expected, result)
|
||||
self.m.VerifyAll()
|
||||
|
||||
mock_call.assert_called_once_with(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
)
|
||||
|
||||
@mock.patch.object(rpc_client.EngineClient, 'call')
|
||||
def test_index_multiple_resource_names(self, mock_call, mock_enforce):
|
||||
|
@ -260,13 +260,8 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
u'resource_type': u'AWS::EC2::Instance',
|
||||
}
|
||||
]
|
||||
self.m.StubOutWithMock(rpc_client.EngineClient, 'call')
|
||||
rpc_client.EngineClient.call(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
).AndReturn(engine_resp)
|
||||
self.m.ReplayAll()
|
||||
mock_call = self.patchobject(rpc_client.EngineClient, 'call',
|
||||
return_value=engine_resp)
|
||||
|
||||
result = self.controller.index(req, tenant_id=self.tenant,
|
||||
stack_name=stack_identity.stack_name,
|
||||
|
@ -293,7 +288,12 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
}
|
||||
|
||||
self.assertEqual(expected, result)
|
||||
self.m.VerifyAll()
|
||||
|
||||
mock_call.assert_called_once_with(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
)
|
||||
|
||||
def test_index_stack_nonexist(self, mock_enforce):
|
||||
self._mock_enforce_setup(mock_enforce, 'index', True)
|
||||
|
@ -307,13 +307,8 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
'sort_dir': None, 'filters': None}
|
||||
|
||||
error = heat_exc.EntityNotFound(entity='Stack', name='a')
|
||||
self.m.StubOutWithMock(rpc_client.EngineClient, 'call')
|
||||
rpc_client.EngineClient.call(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
).AndRaise(tools.to_remote_error(error))
|
||||
self.m.ReplayAll()
|
||||
mock_call = self.patchobject(rpc_client.EngineClient, 'call',
|
||||
side_effect=tools.to_remote_error(error))
|
||||
|
||||
resp = tools.request_with_middleware(
|
||||
fault.FaultWrapper,
|
||||
|
@ -324,7 +319,12 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
|
||||
self.assertEqual(404, resp.json['code'])
|
||||
self.assertEqual('EntityNotFound', resp.json['error']['type'])
|
||||
self.m.VerifyAll()
|
||||
|
||||
mock_call.assert_called_once_with(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
)
|
||||
|
||||
def test_index_err_denied_policy(self, mock_enforce):
|
||||
self._mock_enforce_setup(mock_enforce, 'index', False)
|
||||
|
@ -357,13 +357,8 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
'sort_dir': None, 'filters': {'resource_name': res_name}}
|
||||
|
||||
engine_resp = []
|
||||
self.m.StubOutWithMock(rpc_client.EngineClient, 'call')
|
||||
rpc_client.EngineClient.call(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
).AndReturn(engine_resp)
|
||||
self.m.ReplayAll()
|
||||
mock_call = self.patchobject(rpc_client.EngineClient, 'call',
|
||||
return_value=engine_resp)
|
||||
|
||||
self.assertRaises(webob.exc.HTTPNotFound,
|
||||
self.controller.index,
|
||||
|
@ -371,7 +366,12 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
stack_name=stack_identity.stack_name,
|
||||
stack_id=stack_identity.stack_id,
|
||||
resource_name=res_name)
|
||||
self.m.VerifyAll()
|
||||
|
||||
mock_call.assert_called_once_with(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
)
|
||||
|
||||
@mock.patch.object(rpc_client.EngineClient, 'call')
|
||||
def test_index_whitelists_pagination_params(self, mock_call, mock_enforce):
|
||||
|
@ -505,13 +505,8 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
u'resource_type': u'AWS::EC2::Instance',
|
||||
}
|
||||
]
|
||||
self.m.StubOutWithMock(rpc_client.EngineClient, 'call')
|
||||
rpc_client.EngineClient.call(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
).AndReturn(engine_resp)
|
||||
self.m.ReplayAll()
|
||||
mock_call = self.patchobject(rpc_client.EngineClient, 'call',
|
||||
return_value=engine_resp)
|
||||
|
||||
result = self.controller.show(req, tenant_id=self.tenant,
|
||||
stack_name=stack_identity.stack_name,
|
||||
|
@ -540,7 +535,12 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
}
|
||||
|
||||
self.assertEqual(expected, result)
|
||||
self.m.VerifyAll()
|
||||
|
||||
mock_call.assert_called_once_with(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
)
|
||||
|
||||
def test_show_bad_resource(self, mock_enforce):
|
||||
self._mock_enforce_setup(mock_enforce, 'show', True)
|
||||
|
@ -558,13 +558,8 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
'filters': {'resource_name': res_name, 'uuid': '42'}}
|
||||
|
||||
engine_resp = []
|
||||
self.m.StubOutWithMock(rpc_client.EngineClient, 'call')
|
||||
rpc_client.EngineClient.call(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
).AndReturn(engine_resp)
|
||||
self.m.ReplayAll()
|
||||
mock_call = self.patchobject(rpc_client.EngineClient, 'call',
|
||||
return_value=engine_resp)
|
||||
|
||||
self.assertRaises(webob.exc.HTTPNotFound,
|
||||
self.controller.show,
|
||||
|
@ -572,7 +567,12 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
stack_name=stack_identity.stack_name,
|
||||
stack_id=stack_identity.stack_id,
|
||||
resource_name=res_name, event_id=event_id)
|
||||
self.m.VerifyAll()
|
||||
|
||||
mock_call.assert_called_once_with(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
)
|
||||
|
||||
def test_show_stack_nonexist(self, mock_enforce):
|
||||
self._mock_enforce_setup(mock_enforce, 'show', True)
|
||||
|
@ -590,13 +590,8 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
'filters': {'resource_name': res_name, 'uuid': '42'}}
|
||||
|
||||
error = heat_exc.EntityNotFound(entity='Stack', name='a')
|
||||
self.m.StubOutWithMock(rpc_client.EngineClient, 'call')
|
||||
rpc_client.EngineClient.call(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
).AndRaise(tools.to_remote_error(error))
|
||||
self.m.ReplayAll()
|
||||
mock_call = self.patchobject(rpc_client.EngineClient, 'call',
|
||||
side_effect=tools.to_remote_error(error))
|
||||
|
||||
resp = tools.request_with_middleware(
|
||||
fault.FaultWrapper,
|
||||
|
@ -609,7 +604,12 @@ class EventControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||
|
||||
self.assertEqual(404, resp.json['code'])
|
||||
self.assertEqual('EntityNotFound', resp.json['error']['type'])
|
||||
self.m.VerifyAll()
|
||||
|
||||
mock_call.assert_called_once_with(
|
||||
req.context,
|
||||
('list_events', kwargs),
|
||||
version='1.31'
|
||||
)
|
||||
|
||||
def test_show_err_denied_policy(self, mock_enforce):
|
||||
self._mock_enforce_setup(mock_enforce, 'show', False)
|
||||
|
|
Loading…
Reference in New Issue