Skip to content

Commit

Permalink
Fixed borked tests
Browse files Browse the repository at this point in the history
Signed-off-by: quobix <[email protected]>
  • Loading branch information
daveshanley committed Dec 22, 2023
1 parent b6f090f commit 6888639
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions mock/mock_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ func TestNewMockEngine_ValidateSecurity_FailAPIKey_Query(t *testing.T) {
operation := me.findOperation(request, path)

// mutate securityScheme to be a query param
doc.Components.SecuritySchemes["ApiKeyAuth"].In = "query"
doc.Components.SecuritySchemes["ApiKeyAuth"].Name = "pizza-cake-burger"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").In = "query"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").Name = "pizza-cake-burger"

err := me.ValidateSecurity(request, operation)
assert.Error(t, err)
Expand All @@ -147,8 +147,8 @@ func TestNewMockEngine_ValidateSecurity_PassAPIKey_Query(t *testing.T) {
operation := me.findOperation(request, path)

// mutate securityScheme to be a query param
doc.Components.SecuritySchemes["ApiKeyAuth"].In = "query"
doc.Components.SecuritySchemes["ApiKeyAuth"].Name = "pizza-burger-cake"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").In = "query"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").Name = "pizza-burger-cake"

err := me.ValidateSecurity(request, operation)
assert.NoError(t, err)
Expand All @@ -164,8 +164,8 @@ func TestNewMockEngine_ValidateSecurity_FailAPIKey_Cookie(t *testing.T) {
operation := me.findOperation(request, path)

// mutate securityScheme to be a query param
doc.Components.SecuritySchemes["ApiKeyAuth"].In = "cookie"
doc.Components.SecuritySchemes["ApiKeyAuth"].Name = "burger-chips-beer"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").In = "cookie"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").Name = "burger-chips-beer"

err := me.ValidateSecurity(request, operation)
assert.Error(t, err)
Expand All @@ -186,8 +186,8 @@ func TestNewMockEngine_ValidateSecurity_PassAPIKey_Cookie(t *testing.T) {
operation := me.findOperation(request, path)

// mutate securityScheme to be a query param
doc.Components.SecuritySchemes["ApiKeyAuth"].In = "cookie"
doc.Components.SecuritySchemes["ApiKeyAuth"].Name = "burger-chips-beer"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").In = "cookie"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").Name = "burger-chips-beer"

err := me.ValidateSecurity(request, operation)
assert.NoError(t, err)
Expand All @@ -204,8 +204,8 @@ func TestNewMockEngine_ValidateSecurity_FailHTTP_Bearer(t *testing.T) {
operation := me.findOperation(request, path)

// mutate securityScheme to be a query param
doc.Components.SecuritySchemes["ApiKeyAuth"].Type = "http"
doc.Components.SecuritySchemes["ApiKeyAuth"].Scheme = "bearer"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").Type = "http"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").Scheme = "bearer"

err := me.ValidateSecurity(request, operation)
assert.Error(t, err)
Expand All @@ -224,8 +224,8 @@ func TestNewMockEngine_ValidateSecurity_PassHTTP_Bearer(t *testing.T) {
operation := me.findOperation(request, path)

// mutate securityScheme to be a query param
doc.Components.SecuritySchemes["ApiKeyAuth"].Type = "http"
doc.Components.SecuritySchemes["ApiKeyAuth"].Scheme = "bearer"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").Type = "http"
doc.Components.SecuritySchemes.GetOrZero("ApiKeyAuth").Scheme = "bearer"

err := me.ValidateSecurity(request, operation)
assert.NoError(t, err)
Expand Down

0 comments on commit 6888639

Please sign in to comment.