MCPcopy
hub / github.com/dosco/graphjin / TestNoopAuth

Function TestNoopAuth

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

Source from the content-addressed store, hash-verified

24}
25
26func TestNoopAuth(t *testing.T) {
27 p, err := NewAuthProvider(AuthConfig{}, nil)
28 if err != nil {
29 t.Fatal(err)
30 }
31 req := newTestRequest(t, "https://api.example.com/users")
32 if err := p.Apply(context.Background(), req, nil); err != nil {
33 t.Fatal(err)
34 }
35 if req.Header.Get("Authorization") != "" {
36 t.Error("noop auth set Authorization header")
37 }
38}
39
40func TestBearerAuthStatic(t *testing.T) {
41 p, err := NewAuthProvider(AuthConfig{Scheme: "bearer", Token: "abc123"}, nil)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected