INNER CODE UNIT · Go
TestResponseContainsExpectedStatus
dikhan/terraform-provider-openapi · openapi/common_test.go:155
func TestResponseContainsExpectedStatus(t *testing.T) {
testCases := []struct {
name string
inputResponseStatusCodes []int
inputResponseCode int
expectedResult bool
}{
{
name: "response code that exists in the given list of input status codes",
inputResponseStatusCodes: []int{http.StatusCreated, http.StatusAccepted},
inputResponseCode: http.StatusCreated,
expectedResult: true,
},
{
name: "response code that DOES NOT exists in the given list of input status codes",
inputResponseStatusCodes: []int{http.StatusCreated, http.StatusAccepted},
inputResponseCode: http.StatusUnauthorized,
expectedResult: false,