1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-24 15:58:08 +00:00

Endpoint for getting information about a compute node

This commit is contained in:
Julien Duponchelle 2016-05-12 16:35:14 +02:00
parent 5280644327
commit b46a0ff4ae
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
2 changed files with 32 additions and 0 deletions

View File

@ -60,6 +60,20 @@ class ComputeHandler:
controller = Controller.instance()
response.json([c for c in controller.computes.values()])
@classmethod
@Route.get(
r"/computes/{compute_id}",
description="Get a compute node informations",
status_codes={
200: "Compute list"
},
output=COMPUTE_OBJECT_SCHEMA)
def get(request, response):
controller = Controller.instance()
compute = controller.get_compute(request.match_info["compute_id"])
response.json(compute)
@classmethod
@Route.post(
r"/computes/shutdown",

View File

@ -36,6 +36,24 @@ def test_compute_create(http_controller, controller):
assert controller.computes["my_compute_id"].host == "example.com"
def test_compute_get(http_controller, controller):
params = {
"compute_id": "my_compute_id",
"protocol": "http",
"host": "example.com",
"port": 84,
"user": "julien",
"password": "secure"
}
response = http_controller.post("/computes", params)
assert response.status == 201
response = http_controller.get("/computes/my_compute_id", example=True)
assert response.status == 200
assert response.json["protocol"] == "http"
def test_compute_list(http_controller, controller):
params = {