mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Disallow / in compute_id because it was a stupid idea
This commit is contained in:
parent
917c1c7f84
commit
e05b0a396e
@ -329,4 +329,4 @@ class Compute:
|
|||||||
Forward a call to the emulator on compute
|
Forward a call to the emulator on compute
|
||||||
"""
|
"""
|
||||||
res = yield from self.get("/{}/{}".format(type, path))
|
res = yield from self.get("/{}/{}".format(type, path))
|
||||||
return res
|
return res.json
|
||||||
|
@ -78,7 +78,7 @@ class ComputeHandler:
|
|||||||
response.json(compute)
|
response.json(compute)
|
||||||
|
|
||||||
@Route.get(
|
@Route.get(
|
||||||
r"/computes/{compute_id:.+}/{emulator}/images",
|
r"/computes/{compute_id}/{emulator}/images",
|
||||||
parameters={
|
parameters={
|
||||||
"compute_id": "Compute UUID"
|
"compute_id": "Compute UUID"
|
||||||
},
|
},
|
||||||
@ -94,7 +94,7 @@ class ComputeHandler:
|
|||||||
response.json(images)
|
response.json(images)
|
||||||
|
|
||||||
@Route.get(
|
@Route.get(
|
||||||
r"/computes/{compute_id:.+}/{emulator}/vms",
|
r"/computes/{compute_id}/{emulator}/vms",
|
||||||
parameters={
|
parameters={
|
||||||
"compute_id": "Compute UUID"
|
"compute_id": "Compute UUID"
|
||||||
},
|
},
|
||||||
@ -110,7 +110,7 @@ class ComputeHandler:
|
|||||||
response.json(images)
|
response.json(images)
|
||||||
|
|
||||||
@Route.get(
|
@Route.get(
|
||||||
r"/computes/{compute_id:.+}",
|
r"/computes/{compute_id}",
|
||||||
description="Get a compute server information",
|
description="Get a compute server information",
|
||||||
status_codes={
|
status_codes={
|
||||||
200: "Compute server information returned"
|
200: "Compute server information returned"
|
||||||
|
@ -61,7 +61,7 @@ def test_compute_create_with_id(http_controller, controller):
|
|||||||
def test_compute_get(http_controller, controller):
|
def test_compute_get(http_controller, controller):
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"compute_id": "my_compute/id",
|
"compute_id": "my_compute_id",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": "example.com",
|
"host": "example.com",
|
||||||
"port": 84,
|
"port": 84,
|
||||||
@ -71,7 +71,7 @@ def test_compute_get(http_controller, controller):
|
|||||||
response = http_controller.post("/computes", params)
|
response = http_controller.post("/computes", params)
|
||||||
assert response.status == 201
|
assert response.status == 201
|
||||||
|
|
||||||
response = http_controller.get("/computes/my_compute/id", example=True)
|
response = http_controller.get("/computes/my_compute_id", example=True)
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
assert response.json["protocol"] == "http"
|
assert response.json["protocol"] == "http"
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ def test_compute_get(http_controller, controller):
|
|||||||
def test_compute_update(http_controller, controller):
|
def test_compute_update(http_controller, controller):
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"compute_id": "my_compute/id",
|
"compute_id": "my_compute_id",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": "example.com",
|
"host": "example.com",
|
||||||
"port": 84,
|
"port": 84,
|
||||||
@ -89,12 +89,12 @@ def test_compute_update(http_controller, controller):
|
|||||||
response = http_controller.post("/computes", params)
|
response = http_controller.post("/computes", params)
|
||||||
assert response.status == 201
|
assert response.status == 201
|
||||||
|
|
||||||
response = http_controller.get("/computes/my_compute/id")
|
response = http_controller.get("/computes/my_compute_id")
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
assert response.json["protocol"] == "http"
|
assert response.json["protocol"] == "http"
|
||||||
|
|
||||||
params["protocol"] = "https"
|
params["protocol"] = "https"
|
||||||
response = http_controller.put("/computes/my_compute/id", params, example=True)
|
response = http_controller.put("/computes/my_compute_id", params, example=True)
|
||||||
|
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
assert response.json["protocol"] == "https"
|
assert response.json["protocol"] == "https"
|
||||||
@ -135,7 +135,7 @@ def test_compute_list(http_controller, controller):
|
|||||||
def test_compute_delete(http_controller, controller):
|
def test_compute_delete(http_controller, controller):
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"compute_id": "my_compute/id",
|
"compute_id": "my_compute_id",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": "example.com",
|
"host": "example.com",
|
||||||
"port": 84,
|
"port": 84,
|
||||||
@ -148,7 +148,7 @@ def test_compute_delete(http_controller, controller):
|
|||||||
response = http_controller.get("/computes")
|
response = http_controller.get("/computes")
|
||||||
assert len(response.json) == 1
|
assert len(response.json) == 1
|
||||||
|
|
||||||
response = http_controller.delete("/computes/my_compute/id")
|
response = http_controller.delete("/computes/my_compute_id")
|
||||||
assert response.status == 204
|
assert response.status == 204
|
||||||
|
|
||||||
response = http_controller.get("/computes")
|
response = http_controller.get("/computes")
|
||||||
|
Loading…
Reference in New Issue
Block a user