Naming of Reason constants is inconsistent

Changed ReasonType to StatusReason (to match the field) and
changed CauseReason to CauseType and renamed StatusCause.Reason to
Type.
This commit is contained in:
Clayton Coleman
2014-08-26 13:36:09 -04:00
parent 52923a1348
commit 0a841a49fd
7 changed files with 91 additions and 89 deletions

View File

@@ -626,7 +626,7 @@ func TestAsyncDelayReturnsError(t *testing.T) {
server := httptest.NewServer(handler)
status := expectApiStatus(t, "DELETE", fmt.Sprintf("%s/prefix/version/foo/bar", server.URL), nil, http.StatusConflict)
if status.Status != api.StatusFailure || status.Message == "" || status.Details == nil || status.Reason != api.ReasonTypeAlreadyExists {
if status.Status != api.StatusFailure || status.Message == "" || status.Details == nil || status.Reason != api.StatusReasonAlreadyExists {
t.Errorf("Unexpected status %#v", status)
}
}
@@ -687,7 +687,7 @@ func TestWriteJSONDecodeError(t *testing.T) {
writeJSON(http.StatusOK, api.Codec, &T{"Undecodable"}, w)
}))
status := expectApiStatus(t, "GET", server.URL, nil, http.StatusInternalServerError)
if status.Reason != api.ReasonTypeUnknown {
if status.Reason != api.StatusReasonUnknown {
t.Errorf("unexpected reason %#v", status)
}
if !strings.Contains(status.Message, "type apiserver.T is not registered") {