mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Improvements on API error, swagger and status code (#428)
* improvements on API error, swagger and status code * missing validation * removing typo * fix if-within-if * fix handle app delete
This commit is contained in:
@@ -55,7 +55,7 @@ func TestAppCreate(t *testing.T) {
|
||||
{&datastore.Mock{}, "/v1/apps", `{ "app": { "name": "&&%@!#$#@$" } }`, http.StatusInternalServerError, models.ErrAppsValidationInvalidName},
|
||||
|
||||
// success
|
||||
{&datastore.Mock{}, "/v1/apps", `{ "app": { "name": "teste" } }`, http.StatusCreated, nil},
|
||||
{&datastore.Mock{}, "/v1/apps", `{ "app": { "name": "teste" } }`, http.StatusOK, nil},
|
||||
} {
|
||||
rnr, cancel := testRunner(t)
|
||||
router := testRouter(test.mock, &mqs.Mock{}, rnr, tasks)
|
||||
@@ -226,7 +226,7 @@ func TestAppUpdate(t *testing.T) {
|
||||
Apps: []*models.App{{
|
||||
Name: "myapp",
|
||||
}},
|
||||
}, "/v1/apps/myapp", `{ "app": { "name": "othername" } }`, http.StatusForbidden, nil},
|
||||
}, "/v1/apps/myapp", `{ "app": { "name": "othername" } }`, http.StatusBadRequest, nil},
|
||||
} {
|
||||
rnr, cancel := testRunner(t)
|
||||
router := testRouter(test.mock, &mqs.Mock{}, rnr, tasks)
|
||||
|
||||
Reference in New Issue
Block a user