MCPcopy Index your code
hub / github.com/dosco/graphjin / TestBasicAuth

Function TestBasicAuth

core/openapi/auth_test.go:80–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestBasicAuth(t *testing.T) {
81 p, err := NewAuthProvider(AuthConfig{Scheme: "basic", Username: "u", Password: "p"}, nil)
82 if err != nil {
83 t.Fatal(err)
84 }
85 req := newTestRequest(t, "https://x")
86 if err := p.Apply(context.Background(), req, nil); err != nil {
87 t.Fatal(err)
88 }
89 // "u:p" base64-encoded is "dTpw"
90 if got := req.Header.Get("Authorization"); got != "Basic dTpw" {
91 t.Errorf("Authorization = %q", got)
92 }
93}
94
95func TestApiKeyAuthHeader(t *testing.T) {
96 p, _ := NewAuthProvider(AuthConfig{

Callers

nothing calls this directly

Calls 4

ApplyMethod · 0.95
NewAuthProviderFunction · 0.85
newTestRequestFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected