コード例 #1
0
    def test_delete_host(self):
        resp = self.post_json('/api/v1/host/', h1)
        self.assertEqual('http://localhost/api/v1/host/host_1/', resp.location)

        headers = [('Authorization', 'Token ' + h1['api_key'])]
        resp = self.app.delete(
            resp.location, headers=headers, content_type='application/json')
        h = list(hosts.list())
        self.assertEqual(0, len(h))
コード例 #2
0
    def test_create_host(self):
        resp = self.post_json('/api/v1/host/', h1)
        self.assertEqual('http://localhost/api/v1/host/host_1/', resp.location)
        h = list(hosts.list())
        self.assertEqual(1, len(h))
        self.assertEqual('host_1', h[0])

        data = self.get_json('/api/v1/host/')
        self.assertEqual(1, len(data['hosts']))
        self.assertEqual('host_1', data['hosts'][0])
コード例 #3
0
def index():
    host_list = [hosts.get(x) for x in hosts.list()]
    for h in host_list:
        h.container_list = [h.containers.get(x) for x in h.containers.list()]
    requests = [container_requests.get(x) for x in container_requests.list()]
    return render_template('index.html', hosts=host_list, requests=requests)
コード例 #4
0
ファイル: api.py プロジェクト: doanac/cya
def host_list():
    return jsonify({"hosts": [x for x in hosts.list()]})
コード例 #5
0
ファイル: api.py プロジェクト: doanac/cya
def host_list():
    return jsonify({'hosts': [x for x in hosts.list()]})
コード例 #6
0
ファイル: ui.py プロジェクト: doanac/cya
def index():
    host_list = [hosts.get(x) for x in hosts.list()]
    for h in host_list:
        h.container_list = [h.containers.get(x) for x in h.containers.list()]
    requests = [container_requests.get(x) for x in container_requests.list()]
    return render_template('index.html', hosts=host_list, requests=requests)