Revised test case that allows flexible profile update
This commit is contained in:
parent
5727fd4d8e
commit
4aff069b7a
@ -108,6 +108,8 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
|
|||||||
'marker': 'fake marker',
|
'marker': 'fake marker',
|
||||||
'sort_keys': 'fake sort keys',
|
'sort_keys': 'fake sort keys',
|
||||||
'sort_dir': 'fake sort dir',
|
'sort_dir': 'fake sort dir',
|
||||||
|
'show_deleted': False,
|
||||||
|
'filters': None,
|
||||||
'balrog': 'you shall not pass!'
|
'balrog': 'you shall not pass!'
|
||||||
}
|
}
|
||||||
req = self._get('/profiles', params=params)
|
req = self._get('/profiles', params=params)
|
||||||
@ -468,13 +470,10 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
|
|||||||
req = self._put('/profiles/%(profile_id)s' % {'profile_id': pid},
|
req = self._put('/profiles/%(profile_id)s' % {'profile_id': pid},
|
||||||
json.dumps(body))
|
json.dumps(body))
|
||||||
|
|
||||||
mock_call = self.patchobject(rpc_client.EngineClient, 'call')
|
self.patchobject(rpc_client.EngineClient, 'call', return_value={})
|
||||||
ex = self.assertRaises(exc.HTTPBadRequest, self.controller.update,
|
result = self.controller.update(req, tenant_id=self.tenant,
|
||||||
req, tenant_id=self.tenant,
|
profile_id=pid, body=body)
|
||||||
profile_id=pid, body=body)
|
self.assertEqual({'profile': {}}, result)
|
||||||
|
|
||||||
self.assertEqual('No profile name specified', six.text_type(ex))
|
|
||||||
self.assertFalse(mock_call.called)
|
|
||||||
|
|
||||||
def test_profile_update_no_spec(self, mock_enforce):
|
def test_profile_update_no_spec(self, mock_enforce):
|
||||||
self._mock_enforce_setup(mock_enforce, 'update', True)
|
self._mock_enforce_setup(mock_enforce, 'update', True)
|
||||||
@ -490,7 +489,7 @@ class ProfileControllerTest(shared.ControllerTest, base.SenlinTestCase):
|
|||||||
json.dumps(body))
|
json.dumps(body))
|
||||||
|
|
||||||
engine_response = {
|
engine_response = {
|
||||||
u'id': pid,
|
u'id': 'dddd-eeee-ffff',
|
||||||
u'name': u'new_profile',
|
u'name': u'new_profile',
|
||||||
u'type': u'test_profile_type',
|
u'type': u'test_profile_type',
|
||||||
u'spec': {
|
u'spec': {
|
||||||
|
Loading…
Reference in New Issue
Block a user