github.com/jameswoolfenden/terraform@v0.11.12-beta1/svchost/auth/token_credentials_test.go (about)

     1  package auth
     2  
     3  import (
     4  	"net/http"
     5  	"testing"
     6  )
     7  
     8  func TestHostCredentialsToken(t *testing.T) {
     9  	creds := HostCredentialsToken("foo-bar")
    10  	req := &http.Request{}
    11  
    12  	creds.PrepareRequest(req)
    13  
    14  	authStr := req.Header.Get("authorization")
    15  	if got, want := authStr, "Bearer foo-bar"; got != want {
    16  		t.Errorf("wrong Authorization header value %q; want %q", got, want)
    17  	}
    18  }