def test_cluster_create(self):
"""
Verify creating a cluster.
"""
with mock.patch('cherrypy.engine.publish') as _publish:
manager = mock.MagicMock(StoreHandlerManager)
_publish.return_value = [manager]
test_cluster = make_new(CLUSTER_WITH_HOST)
# Verify with creation
manager.get.side_effect = (
Exception,
test_cluster,
test_cluster,
test_cluster
)
test_body = '{"network": "default"}'
body = self.simulate_request(
'/api/v0/cluster/development', method='PUT', body=test_body)
self.assertEquals(falcon.HTTP_201, self.srmock.status)
self.assertEquals('{}', body[0])
# Verify with existing cluster
manager.get.return_value = CLUSTER
body = self.simulate_request(
'/api/v0/cluster/development', method='PUT', body=test_body)
self.assertEquals(falcon.HTTP_201, self.srmock.status)
self.assertEquals('{}', body[0])
test_handlers_clusters.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录