(t *testing.T)
| 78 | } |
| 79 | |
| 80 | func 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 | |
| 95 | func TestApiKeyAuthHeader(t *testing.T) { |
| 96 | p, _ := NewAuthProvider(AuthConfig{ |
nothing calls this directly
no test coverage detected