INNER CODE UNIT · Go

TestCheckHTTPStatusCode

dikhan/terraform-provider-openapi · openapi/common_test.go:90

func TestCheckHTTPStatusCode(t *testing.T) {
	testCases := []struct {
		name             string
		inputResponse    *http.Response
		inputStatusCodes []int
		expectedError    error
	}{
		{
			name: "response containing a status codes that matches one of the expected response status codes",
			inputResponse: &http.Response{
				StatusCode: http.StatusOK,
			},
			inputStatusCodes: []int{http.StatusOK},
			expectedError:    nil,
		},
		{
			name: "reading the body response returns an error",
			inputResponse: &http.Response{

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…