Disallow / in compute_id because it was a stupid idea

This commit is contained in:
Julien Duponchelle 2016-06-02 18:38:47 +02:00
parent 917c1c7f84
commit e05b0a396e
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
3 changed files with 11 additions and 11 deletions

View File

@ -329,4 +329,4 @@ class Compute:
Forward a call to the emulator on compute
"""
res = yield from self.get("/{}/{}".format(type, path))
return res
return res.json

View File

@ -78,7 +78,7 @@ class ComputeHandler:
response.json(compute)
@Route.get(
r"/computes/{compute_id:.+}/{emulator}/images",
r"/computes/{compute_id}/{emulator}/images",
parameters={
"compute_id": "Compute UUID"
},
@ -94,7 +94,7 @@ class ComputeHandler:
response.json(images)
@Route.get(
r"/computes/{compute_id:.+}/{emulator}/vms",
r"/computes/{compute_id}/{emulator}/vms",
parameters={
"compute_id": "Compute UUID"
},
@ -110,7 +110,7 @@ class ComputeHandler:
response.json(images)
@Route.get(
r"/computes/{compute_id:.+}",
r"/computes/{compute_id}",
description="Get a compute server information",
status_codes={
200: "Compute server information returned"

View File

@ -61,7 +61,7 @@ def test_compute_create_with_id(http_controller, controller):
def test_compute_get(http_controller, controller):
params = {
"compute_id": "my_compute/id",
"compute_id": "my_compute_id",
"protocol": "http",
"host": "example.com",
"port": 84,
@ -71,7 +71,7 @@ def test_compute_get(http_controller, controller):
response = http_controller.post("/computes", params)
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.json["protocol"] == "http"
@ -79,7 +79,7 @@ def test_compute_get(http_controller, controller):
def test_compute_update(http_controller, controller):
params = {
"compute_id": "my_compute/id",
"compute_id": "my_compute_id",
"protocol": "http",
"host": "example.com",
"port": 84,
@ -89,12 +89,12 @@ def test_compute_update(http_controller, controller):
response = http_controller.post("/computes", params)
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.json["protocol"] == "http"
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.json["protocol"] == "https"
@ -135,7 +135,7 @@ def test_compute_list(http_controller, controller):
def test_compute_delete(http_controller, controller):
params = {
"compute_id": "my_compute/id",
"compute_id": "my_compute_id",
"protocol": "http",
"host": "example.com",
"port": 84,
@ -148,7 +148,7 @@ def test_compute_delete(http_controller, controller):
response = http_controller.get("/computes")
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
response = http_controller.get("/computes")