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))
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])
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)
def host_list(): return jsonify({"hosts": [x for x in hosts.list()]})
def host_list(): return jsonify({'hosts': [x for x in hosts.list()]})