diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go index be4166ff1..136f6b1f8 100644 --- a/pkg/webservice/handlers_test.go +++ b/pkg/webservice/handlers_test.go @@ -1228,7 +1228,7 @@ func assertApplicationExists(t *testing.T, resp *MockResponseWriter) { err := json.Unmarshal(resp.outputBytes, &errInfo) assert.NilError(t, err, "failed to unmarshal applications dao response from response body") assert.Equal(t, http.StatusBadRequest, resp.statusCode, "Incorrect Status code") - assert.Equal(t, errInfo.Message, "Application not found", "JSON error message is incorrect") + assert.Equal(t, errInfo.Message, ApplicationDoesNotExists, "JSON error message is incorrect") assert.Equal(t, errInfo.StatusCode, http.StatusBadRequest) } @@ -1237,7 +1237,7 @@ func assertUserExists(t *testing.T, resp *MockResponseWriter) { err := json.Unmarshal(resp.outputBytes, &errInfo) assert.NilError(t, err, "failed to unmarshal applications dao response from response body") assert.Equal(t, http.StatusBadRequest, resp.statusCode, "Incorrect Status code") - assert.Equal(t, errInfo.Message, "User not found", "JSON error message is incorrect") + assert.Equal(t, errInfo.Message, UserDoesNotExists, "JSON error message is incorrect") assert.Equal(t, errInfo.StatusCode, http.StatusBadRequest) } @@ -1246,7 +1246,7 @@ func assertUserNameExists(t *testing.T, resp *MockResponseWriter) { err := json.Unmarshal(resp.outputBytes, &errInfo) assert.NilError(t, err, "failed to unmarshal applications dao response from response body") assert.Equal(t, http.StatusBadRequest, resp.statusCode, "Incorrect Status code") - assert.Equal(t, errInfo.Message, "User name is missing", "JSON error message is incorrect") + assert.Equal(t, errInfo.Message, UserNameMissing, "JSON error message is incorrect") assert.Equal(t, errInfo.StatusCode, http.StatusBadRequest) } @@ -1255,7 +1255,7 @@ func assertGroupExists(t *testing.T, resp *MockResponseWriter) { err := json.Unmarshal(resp.outputBytes, &errInfo) assert.NilError(t, err, "failed to unmarshal applications dao response from response body") assert.Equal(t, http.StatusBadRequest, resp.statusCode, "Incorrect Status code") - assert.Equal(t, errInfo.Message, "Group not found", "JSON error message is incorrect") + assert.Equal(t, errInfo.Message, GroupDoesNotExists, "JSON error message is incorrect") assert.Equal(t, errInfo.StatusCode, http.StatusBadRequest) } @@ -1264,7 +1264,7 @@ func assertGroupNameExists(t *testing.T, resp *MockResponseWriter) { err := json.Unmarshal(resp.outputBytes, &errInfo) assert.NilError(t, err, "failed to unmarshal applications dao response from response body") assert.Equal(t, http.StatusBadRequest, resp.statusCode, "Incorrect Status code") - assert.Equal(t, errInfo.Message, "Group name is missing", "JSON error message is incorrect") + assert.Equal(t, errInfo.Message, GroupNameMissing, "JSON error message is incorrect") assert.Equal(t, errInfo.StatusCode, http.StatusBadRequest) } @@ -1273,7 +1273,7 @@ func assertNodeIDExists(t *testing.T, resp *MockResponseWriter) { err := json.Unmarshal(resp.outputBytes, &errInfo) assert.NilError(t, err, "failed to unmarshal node dao response from response body") assert.Equal(t, http.StatusBadRequest, resp.statusCode, "Incorrect Status code") - assert.Equal(t, errInfo.Message, "Node not found", "JSON error message is incorrect") + assert.Equal(t, errInfo.Message, NodeDoesNotExists, "JSON error message is incorrect") assert.Equal(t, errInfo.StatusCode, http.StatusBadRequest) }