jobqueue: add back tests for the API
Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
94e1e6f42b
commit
7e78b4051d
2 changed files with 83 additions and 19 deletions
|
|
@ -122,8 +122,20 @@ func (api *API) updateJobHandler(writer http.ResponseWriter, request *http.Reque
|
|||
err = json.NewDecoder(request.Body).Decode(&body)
|
||||
if err != nil {
|
||||
statusResponseError(writer, http.StatusBadRequest, "invalid status: "+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
api.store.UpdateCompose(id, body.Status)
|
||||
err = api.store.UpdateCompose(id, body.Status)
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
case *store.NotFoundError:
|
||||
statusResponseError(writer, http.StatusNotFound, err.Error())
|
||||
case *store.NotPendingError:
|
||||
statusResponseError(writer, http.StatusBadRequest, err.Error())
|
||||
case *store.InvalidRequestError:
|
||||
statusResponseError(writer, http.StatusBadRequest, err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
statusResponseOK(writer)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue