コード例 #1
0
ファイル: host.py プロジェクト: argux/server
    def test_hosts(self):
        """

        """
        r = request.Request.blank(path='/argux/rest/1.0/host')
        r.registry = Registry()
        r.registry.settings = {}
        r.registry.settings['dao'] = dao.DAO()
        v = RestHostViews(r)
        response = v.hosts_1_view()

        # Check if 'hosts' is part of the response
        self.assertEquals(('hosts' in response), True)

        # Check if hosts contains one member
        hosts = response['hosts']
        self.assertEquals(len(hosts), 1)

        # Check if the member is localhost
        host = hosts[0]
        self.assertEquals(host['name'], "localhost")