test_api_entity.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:almanach 作者: openstack 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号