github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccerror/v3_unexpected_response_error_test.go (about)

     1  package ccerror_test
     2  
     3  import (
     4  	"net/http"
     5  
     6  	. "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
     7  
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("V3UnexpectedResponseError", func() {
    13  	Describe("Error", func() {
    14  		It("returns all of the errors joined with newlines", func() {
    15  			err := V3UnexpectedResponseError{
    16  				ResponseCode: http.StatusTeapot,
    17  				V3ErrorResponse: V3ErrorResponse{
    18  					Errors: []V3Error{
    19  						{
    20  							Code:   282010,
    21  							Detail: "detail 1",
    22  							Title:  "title-1",
    23  						},
    24  						{
    25  							Code:   10242013,
    26  							Detail: "detail 2",
    27  							Title:  "title-2",
    28  						},
    29  					},
    30  				},
    31  				RequestIDs: []string{
    32  					"6e0b4379-f5f7-4b2b-56b0-9ab7e96eed95",
    33  					"6e0b4379-f5f7-4b2b-56b0-9ab7e96eed95::7445d9db-c31e-410d-8dc5-9f79ec3fc26f",
    34  				},
    35  			}
    36  
    37  			Expect(err).To(MatchError(`Unexpected Response
    38  Response Code: 418
    39  Request ID:    6e0b4379-f5f7-4b2b-56b0-9ab7e96eed95
    40  Request ID:    6e0b4379-f5f7-4b2b-56b0-9ab7e96eed95::7445d9db-c31e-410d-8dc5-9f79ec3fc26f
    41  Code: 282010, Title: title-1, Detail: detail 1
    42  Code: 10242013, Title: title-2, Detail: detail 2`))
    43  		})
    44  	})
    45  })