test_handlers_hosts.py 文件源码

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

项目:commissaire-mvp 作者: projectatomic 项目源码 文件源码
def test_host_status_retrieve_host_only(self):
        """
        Verify retrieving Host status when it is in a host only cluster.
        """
        with mock.patch('cherrypy.engine.publish') as _publish:
            manager = mock.MagicMock(StoreHandlerManager)
            _publish.return_value = [manager]

            test_host = make_new(HOST)
            test_cluster = make_new(CLUSTER)
            test_cluster.hostset = [test_host.address]

            # Verify if the host exists the data is returned
            manager.get.side_effect = (
                test_host,
                test_cluster)

            body = self.simulate_request('/api/v0/host/10.2.0.2/status')
            self.assertEqual(self.srmock.status, falcon.HTTP_200)
            result = json.loads(body[0])
            self.assertEquals(C.CLUSTER_TYPE_HOST, result['type'])
            self.assertEquals('available', result['host']['status'])
            self.assertEquals({}, result['container_manager'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号