Add unit test for API 'check' action

Change-Id: I0fd1e2a88665f2918c03f09a79974b92dd228c56
This commit is contained in:
Zane Bitter 2019-10-25 00:12:16 -04:00
parent 9f3ea0a63e
commit 0f7ea6a0e6
1 changed files with 22 additions and 0 deletions

View File

@ -88,6 +88,28 @@ class ActionControllerTest(tools.ControllerTest, common.HeatTestCase):
('stack_resume', {'stack_identity': stack_identity})
)
def test_action_check(self, mock_enforce):
self._mock_enforce_setup(mock_enforce, 'action', True)
stack_identity = identifier.HeatIdentifier(self.tenant,
'wordpress', '1')
body = {'check': None}
req = self._post(stack_identity._tenant_path() + '/actions',
data=json.dumps(body))
mock_call = self.patchobject(rpc_client.EngineClient, 'call',
return_value=None)
result = self.controller.action(req, tenant_id=self.tenant,
stack_name=stack_identity.stack_name,
stack_id=stack_identity.stack_id,
body=body)
self.assertIsNone(result)
mock_call.assert_called_once_with(
req.context,
('stack_check', {'stack_identity': stack_identity})
)
def _test_action_cancel_update(self, mock_enforce, with_rollback=True):
self._mock_enforce_setup(mock_enforce, 'action', True)
stack_identity = identifier.HeatIdentifier(self.tenant,