def test_update_active_instance_entity_with_bad_payload(self):
self.entity_ctl.update_active_instance_entity.side_effect = ValueError(
'Expecting object: line 1 column 15 (char 14)'
)
instance_id = 'INSTANCE_ID'
data = {
'flavor': 'A_FLAVOR',
}
code, result = self.api_put('/v1/entity/instance/INSTANCE_ID',
data=data,
headers={'X-Auth-Token': 'some token value'})
self.entity_ctl.update_active_instance_entity.assert_called_once_with(instance_id=instance_id, **data)
self.assertIn("error", result)
self.assertEqual(result["error"], 'Invalid parameter or payload')
self.assertEqual(code, 400)
评论列表
文章目录