google: manual testing fixes
I found some errors while manually testing service account impersonation on Azure. This PR includes the fixes that I made. Change-Id: Ia2b194be6c9a7c843e615f9789c8f8203bcbc151 GitHub-Last-Rev: 56907163634bb65457c12320b4081e919cfbbcb2 GitHub-Pull-Request: golang/oauth2#475 Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/291209 Reviewed-by: Cody Oss <codyoss@google.com> Trust: Cody Oss <codyoss@google.com> Trust: Tyler Bui-Palsulich <tbp@google.com> Run-TryBot: Cody Oss <codyoss@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
@@ -7,6 +7,7 @@ package externalaccount
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
@@ -19,11 +20,18 @@ func TestRetrieveURLSubjectToken_Text(t *testing.T) {
|
||||
if r.Method != "GET" {
|
||||
t.Errorf("Unexpected request method, %v is found", r.Method)
|
||||
}
|
||||
fmt.Println(r.Header)
|
||||
if r.Header.Get("Metadata") != "True" {
|
||||
t.Errorf("Metadata header not properly included.")
|
||||
}
|
||||
w.Write([]byte("testTokenValue"))
|
||||
}))
|
||||
heads := make(map[string]string)
|
||||
heads["Metadata"] = "True"
|
||||
cs := CredentialSource{
|
||||
URL: ts.URL,
|
||||
Format: format{Type: fileTypeText},
|
||||
Headers: heads,
|
||||
}
|
||||
tfc := testFileConfig
|
||||
tfc.CredentialSource = cs
|
||||
|
||||
Reference in New Issue
Block a user