diff --git a/internal/test/smoke/domain_update_system_test.go b/internal/test/smoke/domain_update_system_test.go index 2f29e8c6..817864a3 100644 --- a/internal/test/smoke/domain_update_system_test.go +++ b/internal/test/smoke/domain_update_system_test.go @@ -102,8 +102,12 @@ func (s *SuiteDomainUpdateAgent) TestUpdateDomain() { }, Expected: TestCaseExpect{ StatusCode: http.StatusBadRequest, - BodyFunc: WrapBodyFuncErrorResponse(func(t *testing.T, body *ErrorResponse) error { - assert.Equal(t, "'domain_name' may not be changed", body.Message) + BodyFunc: WrapBodyFuncErrorResponse(func(t *testing.T, body *public.ErrorResponse) error { + assert.Equal(t, builder_api.NewErrorResponse(). + Add(*builder_api.NewErrorInfo(http.StatusBadRequest). + WithTitle("'domain_name' may not be changed"). + Build()). + Build(), body) return nil }), }, @@ -119,8 +123,12 @@ func (s *SuiteDomainUpdateAgent) TestUpdateDomain() { }, Expected: TestCaseExpect{ StatusCode: http.StatusBadRequest, - BodyFunc: WrapBodyFuncErrorResponse(func(t *testing.T, body *ErrorResponse) error { - assert.Equal(t, "'realm_name' may not be changed", body.Message) + BodyFunc: WrapBodyFuncErrorResponse(func(t *testing.T, body *public.ErrorResponse) error { + assert.Equal(t, builder_api.NewErrorResponse(). + Add(*builder_api.NewErrorInfo(http.StatusBadRequest). + WithTitle("'realm_name' may not be changed"). + Build()). + Build(), body) return nil }), }, diff --git a/internal/test/smoke/suite_base_test.go b/internal/test/smoke/suite_base_test.go index 784f43fb..f496c99a 100644 --- a/internal/test/smoke/suite_base_test.go +++ b/internal/test/smoke/suite_base_test.go @@ -870,16 +870,7 @@ func TestSuite(t *testing.T) { suite.Run(t, new(SuiteSystemEndpoints)) } -// ErrorResponse represents the error response from the API -// -// Note: the structure is different than the public.ErrorResponse -// as the API doesn't actually return a public.ErrorResponse which it should. -type ErrorResponse struct { - Error string `json:"error"` - Message string `json:"message"` -} - -type BodyFuncErrorResponse func(t *testing.T, body *ErrorResponse) error +type BodyFuncErrorResponse func(t *testing.T, body *public.ErrorResponse) error func WrapBodyFuncErrorResponse(predicate BodyFuncErrorResponse) BodyFunc { if predicate == nil { @@ -888,7 +879,7 @@ func WrapBodyFuncErrorResponse(predicate BodyFuncErrorResponse) BodyFunc { } } return func(t *testing.T, body []byte) bool { - var data ErrorResponse + var data public.ErrorResponse if err := json.Unmarshal(body, &data); err != nil { require.Fail(t, fmt.Errorf("Error unmarshalling body: %w", err).Error()) return false