Esempio n. 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))
Esempio n. 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])
Esempio n. 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)
Esempio n. 4
0
File: api.py Progetto: doanac/cya
def host_list():
    return jsonify({"hosts": [x for x in hosts.list()]})
Esempio n. 5
0
File: api.py Progetto: doanac/cya
def host_list():
    return jsonify({'hosts': [x for x in hosts.list()]})
Esempio n. 6
0
File: ui.py Progetto: 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)