def test_cluster_restart_retrieve(self):
"""
Verify retrieving a cluster restart.
"""
with mock.patch('cherrypy.engine.publish') as _publish:
manager = mock.MagicMock(StoreHandlerManager)
_publish.return_value = [manager]
test_cluster_restart = make_new(CLUSTER_RESTART)
# Verify if the cluster restart exists the data is returned
manager.get.return_value = test_cluster_restart
body = self.simulate_request('/api/v0/cluster/development/restart')
self.assertEqual(falcon.HTTP_200, self.srmock.status)
self.assertEqual(json.loads(test_cluster_restart.to_json()), json.loads(body[0]))
# Verify no cluster restart returns the proper result
manager.get.side_effect = (
test_cluster_restart,
Exception)
body = self.simulate_request('/api/v0/cluster/development/restart')
self.assertEqual(falcon.HTTP_204, self.srmock.status)
self.assertEqual([], body) # Empty data
test_handlers_clusters.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录