functions: returns HTTP error in case of route update attempt (#396)

Ensure that attempts to update route's path are properly handled
with a HTTP error. Moreover, updates swagger file to make it
explicit that routes are immutable.

Fixes #381
This commit is contained in:
C Cirello
2016-12-07 19:54:09 +01:00
committed by GitHub
parent 05cd030bc6
commit 66d446b148
5 changed files with 45 additions and 6 deletions

View File

@@ -203,7 +203,17 @@ func TestRouteUpdate(t *testing.T) {
Path: "/myroute/do",
},
},
}, "/v1/apps/a/routes/myroute/do", `{ "route": { "image": "iron/hello", "path": "/myroute" } }`, http.StatusOK, nil},
}, "/v1/apps/a/routes/myroute/do", `{ "route": { "image": "iron/hello" } }`, http.StatusOK, nil},
// Addresses #381
{&datastore.Mock{
Routes: []*models.Route{
{
AppName: "a",
Path: "/myroute/do",
},
},
}, "/v1/apps/a/routes/myroute/do", `{ "route": { "path": "/otherpath" } }`, http.StatusForbidden, nil},
} {
rnr, cancel := testRunner(t)
router := testRouter(test.ds, &mqs.Mock{}, rnr, tasks)