opentofu/svchost/auth/token_credentials_test.go
Martin Atkins 43a3357473 svchost/auth: token-based HostCredentials
This is the only credentials type we support right now, which just sends
an opaque token via the "Bearer" HTTP auth scheme.
2017-10-19 11:18:43 -07:00

19 lines
367 B
Go

package auth
import (
"net/http"
"testing"
)
func TestHostCredentialsToken(t *testing.T) {
creds := HostCredentialsToken("foo-bar")
req := &http.Request{}
creds.PrepareRequest(req)
authStr := req.Header.Get("authorization")
if got, want := authStr, "Bearer foo-bar"; got != want {
t.Errorf("wrong Authorization header value %q; want %q", got, want)
}
}