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

Function TestBearerAuthStatic

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

Source from the content-addressed store, hash-verified

38}
39
40func TestBearerAuthStatic(t *testing.T) {
41 p, err := NewAuthProvider(AuthConfig{Scheme: "bearer", Token: "abc123"}, nil)
42 if err != nil {
43 t.Fatal(err)
44 }
45 req := newTestRequest(t, "https://api.example.com/users")
46 if err := p.Apply(context.Background(), req, nil); err != nil {
47 t.Fatal(err)
48 }
49 if got := req.Header.Get("Authorization"); got != "Bearer abc123" {
50 t.Errorf("Authorization = %q, want Bearer abc123", got)
51 }
52}
53
54func TestBearerAuthPassThrough(t *testing.T) {
55 p, err := 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