<commit_before>package openapi_test

import (
	"testing"

	openapi "github.com/nasa9084/go-openapi"
)

func TestSecurityScheme(t *testing.T) {
	t.Run("validate", testSecuritySchemeValidate)
}

func testSecuritySchemeValidate(t *testing.T) {
	candidates := []candidate{
		{"empty", openapi.SecurityScheme{}, true},
		{"apiKey/noName", openapi.SecurityScheme{Type: "apiKey", In: "query"}, true},
		{"apiKey/noIn", openapi.SecurityScheme{Type: "apiKey", Name: "foo"}, true},
		{"apiKey/invalidIn", openapi.SecurityScheme{Type: "apiKey", Name: "foo", In: "bar"}, true},
		{"apiKey/valid", openapi.SecurityScheme{Type: "apiKey", Name: "foo", In: "query"}, false},
		{"http/noScheme", openapi.SecurityScheme{Type: "http"}, true},
		{"http/valid", openapi.SecurityScheme{Type: "http", Scheme: "Basic"}, false},
		{"oauth2/noFlows", openapi.SecurityScheme{Type: "oauth2"}, true},
		{"oauth2/emptyFlows", openapi.SecurityScheme{Type: "oauth2", Flows: &openapi.OAuthFlows{}}, false},
		{"oauth2/valid", openapi.SecurityScheme{Type: "oauth2", Flows: &openapi.OAuthFlows{Implicit: &openapi.OAuthFlow{AuthorizationURL: "http://example.com", Scopes: map[string]string{"foo": "bar"}}}}, false},
		{"openIdConnect/noOIDCURL", openapi.SecurityScheme{Type: "openIdConnect"}, true},
		{"openIdConnect/valid", openapi.SecurityScheme{Type: "openIdConnect", OpenIDConnectURL: "http://example.com"}, false},
	}
	testValidater(t, candidates)
}<commit_msg>add invalid SecurityScheme type test<commit_after>package openapi_test

import (
	"testing"

	openapi "github.com/nasa9084/go-openapi"
)

func TestSecurityScheme(t *testing.T) {
	t.Run("validate", testSecuritySchemeValidate)
}

func testSecuritySchemeValidate(t *testing.T) {
	candidates := []candidate{
		{"empty", openapi.SecurityScheme{}, true},
		{"apiKey/noName", openapi.SecurityScheme{Type: "apiKey", In: "query"}, true},
		{"apiKey/noIn", openapi.SecurityScheme{Type: "apiKey", Name: "foo"}, true},
		{"apiKey/invalidIn", openapi.SecurityScheme{Type: "apiKey", Name: "foo", In: "bar"}, true},
		{"apiKey/valid", openapi.SecurityScheme{Type: "apiKey", Name: "foo", In: "query"}, false},
		{"http/noScheme", openapi.SecurityScheme{Type: "http"}, true},
		{"http/valid", openapi.SecurityScheme{Type: "http", Scheme: "Basic"}, false},
		{"oauth2/noFlows", openapi.SecurityScheme{Type: "oauth2"}, true},
		{"oauth2/emptyFlows", openapi.SecurityScheme{Type: "oauth2", Flows: &openapi.OAuthFlows{}}, false},
		{"oauth2/valid", openapi.SecurityScheme{Type: "oauth2", Flows: &openapi.OAuthFlows{Implicit: &openapi.OAuthFlow{AuthorizationURL: "http://example.com", Scopes: map[string]string{"foo": "bar"}}}}, false},
		{"openIdConnect/noOIDCURL", openapi.SecurityScheme{Type: "openIdConnect"}, true},
		{"openIdConnect/valid", openapi.SecurityScheme{Type: "openIdConnect", OpenIDConnectURL: "http://example.com"}, false},
		{"invalidType", openapi.SecurityScheme{Type: "foo"}, true},
	}
	testValidater(t, candidates)
}
{'fraction_non_alphanumeric': 0.19104173736002714, 'fraction_numerical': 0.0067865626060400405, 'mean_word_length': 7.375, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3707780', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1013, 'n_words': 188}