def test_create_instance_invalid_personality(self):
def fake_create(*args, **kwargs):
codec = 'utf8'
content = 'b25zLiINCg0KLVJpY2hhcmQgQ$$%QQmFjaA=='
start_position = 19
end_position = 20
msg = 'invalid start byte'
raise UnicodeDecodeError(codec, content, start_position,
end_position, msg)
self.stubs.Set(compute_api.API, 'create', fake_create)
self.body['server']['personality'] = [
{
"path": "/etc/banner.txt",
"contents": "b25zLiINCg0KLVJpY2hhcmQgQ$$%QQmFjaA==",
},
]
self.req.body = jsonutils.dump_as_bytes(self.body)
self.assertRaises(webob.exc.HTTPBadRequest,
self.controller.create, self.req, self.body)
test_servers.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录